[Answered ]-Django-registration activates user but shows error

1👍

First of all, the subject of your post and the actual description are conflicting. The subject says django-registration always fails to activate the user, but then in your description you say the user gets activated and can log in. Which is it?

Secondly, clicking on the activation link should always send the user to activate.html. You will have a variable called account on that page. If the activation was successful, account will be populated with the User object, otherwise it will be False.

👤Abid A

1👍

There is a big difference between 0.7 and 0.8:

in 0.7:

registration/activate.html is displayed when a user attempts to
activate his/her account.

in 0.8

registration/activate.html

Used if account activation fails.

0👍

Debugging registration.views.activate showed: if the success_url isn’t set,
the backend.post_activation_redirect method is called. If you’re using the default backend, that returns an empty context without the account variable which is queried in the template.
The solution could be to overwrite the default backend.
The only problem is that you cannot pass any objects to views over a redirect. Hence, you cannot pass the account to the template context. You could do it with get params if wanted to.
I decided to just change the activation template and remove the condition.

Leave a comment