default group for new users

486 views
Skip to first unread message

Brian Craft

unread,
May 17, 2011, 2:07:37 PM5/17/11
to django...@googlegroups.com
Is there a good way to add new users to a default group when they are
created (e.g. via django-registration)? I just tried binding the
post_save signal for User, and adding the group in the signal handler
(if "created" is true). However, I haven't found a good place (file)
to put the connect() call, so the signal will be caught: i.e. some
file that will consistently be loaded before a User is created.

I'm currently thinking I will override the django-registration
activate url, and add the code there, before calling
registration.views.activate. Obviously this isn't the most general
solution.

creecode

unread,
May 17, 2011, 2:39:04 PM5/17/11
to django...@googlegroups.com
Hello Brian,

I have a similar signal setup for an app of mine.  I put it at the end of the models.py file.  I seem to recall reading a tip somewhere that this was a good place for something like this.  Perhaps it was the Django or django-registration docs?

Toodle-looooooooooooo...........
creecode

Brian Craft

unread,
May 17, 2011, 2:42:08 PM5/17/11
to django...@googlegroups.com
After much googling, I created a new app called "core" and put the
connect() in the __init__.py. That seems to be working. The problem
with the "put it in models.py" solution is that it isn't really
related to any of my existing apps. Previously I tried putting it in
the project __init__.py, but that works inconsistently, apparently
because django isn't fully initialized when the project __init__.py is
loaded.
Reply all
Reply to author
Forward
0 new messages