There's an error in my code example. That "from registration.views import
activate" should be something like "from registration.views import activate
as original_activate", and the second line should be "resp =
original_activate(request, activation_key)" - otherwise this view recurses
infinitely. Basic idea is the same though.
On Tuesday 26 August 2008 11:36:54 am Aaron Maxwell wrote:
> {{{
> from django.contrib.auth import authenticate, login
> from registration.models import RegistrationProfile
> from registration.views import activate
>
> def activate(request, activation_key):
> '''
> Wrapper around registration module's activate view, which logs in user
> '''
> prior = RegistrationProfile.objects.get(activation_key=activation_key)
> resp = activate(request, activation_key)
> after = RegistrationProfile.objects.get(user=prior.user)
> # The activation key is reset to the string "ACTIVATION_KEY" if
> # the activation is successful
> if after.activation_key != activation_key:
> # user account has been activated
> login(request, after.user)
> return resp
> }}}
--
Aaron Maxwell
http://redsymbol.net
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---