def save(self, commit=True): user = User.objects.create_user(self.cleaned_data['username'], self.cleaned_data['email'], self.cleaned_data['password1']) user.first_name = self.cleaned_data['first_name'] user.last_name = self.cleaned_data['last_name'] user.groups.add(Group.objects.get(name="Volunteer")) user.save() profile = UserProfile(user=user) profile.timezone = self.cleaned_data['timezone'] profile.grad_class = int(self.cleaned_data['grad_class']) profile.membership_status = self.cleaned_data['member_status'] profile.save() return user
def save(self, commit=True): user = User.objects.create_user(self.cleaned_data['username'], self.cleaned_data['email'], self.cleaned_data['password1']) user.first_name = self.cleaned_data['first_name'] user.last_name = self.cleaned_data['last_name'] if self.cleaned_data.get('volunteer'): user.groups.add(Group.objects.get(name="Volunteer")) if self.cleaned_data.get('org_admin'): user.groups.add(Group.objects.get(name="Org_Admin")) user.save() profile = UserProfile(user=user) profile.timezone = self.cleaned_data['timezone'] profile.save() return user