Search - User list
Full Version: Default group for new users
Root » Feature requests » Default group for new users
Hello. I have set up a djangobb project on a site, and through the admin interface I have setup three Groups, and some Categories where the appropriate Groups have permissions.

However, when a new user is registered, they haven't any default group, so they have no permissions at all.
How can I setup a new User to belong to a specific Group by default? Note that I might have missed some step of the forum setup, all the documentation I found was scattered and mostly incomplete.

Thanks in advance.
More correct question: “as do this in django?”

Check django-registration (or what you uses?) registration.signals.user_registered signal and group in handler
I'm sorry, I'm very new with django. I assumed I could do that from the web administration interface.
I'm using a basic_project forum and the registration module, with so far untouched code. Where would I add code so that upon user registration, the user becomes automatically a member of the “Users” group?
Searching the web, I found that I got to do something along the lines:
from registration.signals import user_registered
Where can I add this?
Obviously the new_user_created function is where I add the logic for making the User object a member of the Users group, but I still don't know how to make what I want.
This StackOverflow answer seems related to my issue.
Since the documentation says “connect the signal anywhere in an imported module”, I added the code in (I imagine it's a gross misuse of the file but it works; I will try to make it more “clean” somehow). The function “new_user_created” works now.
So I have to do something like
and the only thing I need to find out is, well, how to set “users_group” to be the group “Users”. Like I said, I'm very new to Django.
put this code in of your custom app:
from registration.signals import *
from django.contrib.auth.models import Group
from django.dispatch import receiver

# Create your models here.

def add_group_to_user(sender, user, request, **kwargs):
defaultgroup = Group.objects.get(name = ‘normaluser’)
if defaultgroup:

'normaluser' is the name of your default group
had thought about it, but did not grow together, in principle, it is easier than the current version, can be in the distant future, and implements
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB