Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To start, I'm not an expert at d-r (django-registration) and actually only checked it out because you mentioned it in your question. So, if anyone else has a better answer please submit it. Anyway, here it goes.</p> <p>I noticed that the way users (or "profiles" as d-r calls them) are created is found in the create_inactive_user function located in registration.models.RegistrationManager. So, in this function after:</p> <pre><code>new_user.is_active = False new_user.save() </code></pre> <p>You could add something like:</p> <pre><code>default_group = Group.objects.get(name=WHATEVER_THE_GROUP_NAME_IS) user_group, is_created = UserGroup.get_or_create(user=new_user) user_group.group = default_group #user_group.groups.add(default_group) # Django ver. 1.7+ user_group.save() </code></pre> <p>You could probably do without the get_or_create as I don't think you can create more than one user with the same username, but I would rather be safe than sorry.</p> <p>This method will cause you to edit the d-r files (which may not be the best thing to do) along with hardcoding certain things (such as the default group name), but it should be a good stepping off point.</p> <p>PS. the default group name could be a variable located in the settings.py file, which would make it more accessible and pretty. Example:</p> <pre><code>settings.py: DEFAULT_GROUP_NAME = 'YOUR GROUP NAME' registration/models.py: default_group = Group.objects.get(name=settings.DEFAULT_GROUP_NAME) </code></pre> <p>Anyway, hope that helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload