taskapp/forms/user.py
changeset 213 a01078a9bbcf
parent 206 85660d75683d
child 219 f04a1ec7a07f
equal deleted inserted replaced
212:9f6a6eaf5df3 213:a01078a9bbcf
     7 
     7 
     8 from django import forms
     8 from django import forms
     9 from pytask.taskapp.models import GENDER_CHOICES, Profile
     9 from pytask.taskapp.models import GENDER_CHOICES, Profile
    10 from registration.forms import RegistrationFormUniqueEmail
    10 from registration.forms import RegistrationFormUniqueEmail
    11 from registration.models import RegistrationProfile
    11 from registration.models import RegistrationProfile
       
    12 from pytask.taskapp.utilities.notification import create_notification
    12 
    13 
    13 class UserProfileEditForm(forms.ModelForm):
    14 class UserProfileEditForm(forms.ModelForm):
    14     """Form used to edit the profile of a user"""
    15     """Form used to edit the profile of a user"""
    15     
    16     
    16     class Meta:
    17     class Meta:
    49         new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'],password=self.cleaned_data['password1'],email=self.cleaned_data['email'])
    50         new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'],password=self.cleaned_data['password1'],email=self.cleaned_data['email'])
    50         
    51         
    51         new_profile = Profile(user=new_user,dob=self.cleaned_data['dob'],gender=self.cleaned_data['gender'])
    52         new_profile = Profile(user=new_user,dob=self.cleaned_data['dob'],gender=self.cleaned_data['gender'])
    52         new_profile.save()
    53         new_profile.save()
    53         
    54         
       
    55         create_notification('NU',new_user)
       
    56         
    54         return new_user
    57         return new_user
    55 
    58 
    56 def UserChoiceForm(choices, instance=None):
    59 def UserChoiceForm(choices, instance=None):
    57     """ take a list of users and return a choice form.
    60     """ take a list of users and return a choice form.
    58     """
    61     """