Commit f916864f authored by Thibaut Broggi's avatar Thibaut Broggi

Add user to group "Padawan" on registration

parent 1486ce3e
Pipeline #1428 passed with stages
in 1 minute and 55 seconds
from django import forms
from django.contrib.auth.models import Group
class TagMultipleChoiceField(forms.ModelMultipleChoiceField):
def prepare_value(self, value):
......@@ -15,3 +15,9 @@ class TagMultipleChoiceField(forms.ModelMultipleChoiceField):
self.validate(value)
self.run_validators(value)
return value
class SignupForm(forms.Form):
def signup(self, request, user):
group = Group.objects.get(name='Padawan')
user.groups.add(group)
user.save()
......@@ -41,3 +41,4 @@ AUTH_PASSWORD_VALIDATORS = [
# Disable two steps logout
ACCOUNT_LOGOUT_ON_GET = True
ACCOUNT_SIGNUP_FORM_CLASS = "rp.forms.SignupForm"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment