我试图在urlpattern中传递参数而不是url标记。
在urls.py中,
re_path(r'^send/(?P<uidb64>[0-9A-Za-z_\-]+)/$', views.send_email, name='send_email'),
在views.py中,
error_messages = { ...
'inactive': _('<a href="/send/">Please get a new email</a>.'),
}
我必须在/ send /中发送参数,如何设置?
答案 0 :(得分:1)
您可以使用reverse或reverse-lazy尝试这样:
error_messages = { ...
'inactive': _('<a href="{}">Please get a new email</a>.'.format(reverse('send_email', args=[some_uuid]))), # where some_uuid will have uuid for the url
}