开发者

Django-registration and activation failure

I don't under stand how开发者_如何转开发 django-registration is handling activation failure? Say, a user just uses a dummy activation key and invokes the url in browser /activation/"key". Now, activation will fail but which url should users be directed to? And, also, the user should be shown the error message. Correct? But, I find after clicking activate, user is shown the activate.html only.


Here is the docstring for the function activate:

On unsuccessful activation, will render the template
registration/activate.html to display an error message; to
override thise, pass the argument template_name (see below).

The default url captured:

              url(r'^activate/(?P<activation_key>\w+)/$',
                   activate,
                   {'backend': 'registration.backends.default.DefaultBackend'},
                   name='registration_activate'),

On success, the activate view redirects to a success URL, therefore the only purpose of the activate.html template is on failure.

Update: looking at the instructions, it even says this explicitly in the "templates required" section:

registration/activate.html

Used if account activation fails. With the default setup, has the following context:

activation_key The activation key used during the activation attempt.


I think django-registration does not handle this properly. Perhaps it is a good idea to file a bug with the upstream code.

Had a to write some template code here as a work around. https://github.com/arky/pootle/commit/8e7f771499206cb6c636a80bc8156db1ecd722b1

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜