0

i have successfully implemented django-registration and it's working fine. for some teasing reasons, i want all the users registering should be able to be super_users( i.e turn on super_user flag in django users model). how can i do this with django-registration i do not want to show if the user is a super user or not in html template , but as soon as he is registered, he should be super user. i have gone thought some large and many example , most of them shows how to add custom filed, i do not know that approach is what i want, i really need some help here.

rgm
  • 1,241
  • 2
  • 16
  • 33

1 Answers1

1

You're looking for signals. Add signals.py to your app and then

# handle signal
def user_registered(sender, user, request, **kwarg):
   user.is_superuser = True
   user.save()

# register signal
user_registered.connect(user_registered)

See explanation at https://django-registration.readthedocs.org/en/latest/signals.html

kgu87
  • 2,050
  • 14
  • 12