Django-registration and activation failure

1.2k Views Asked by At

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.

2

There are 2 best solutions below

0
On

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.

0
On

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