# Path: pytask/profile/models.py
# GENDER_CHOICES = (
#   ('Male', 'Male'),
#   ('Female', 'Female'),
# )
# 
# class Profile(models.Model):
#     full_name = models.CharField(
#       max_length=50, verbose_name="Name as on bank account",
#       help_text="Any DD/Cheque will be issued on this name")
# 
#     user = models.ForeignKey(User, unique = True)
# 
#     role = models.CharField(max_length=255,
#                             choices=ROLES_CHOICES,
#                             default=u"Contributor")
# 
#     pynts = models.PositiveSmallIntegerField(default=0)
# 
#     aboutme = models.TextField(
#       blank = True,
#       help_text="This information will be used to judge the eligibility "
#         "for any task")
# 
#     dob = models.DateField(verbose_name=u"Date of Birth",
#                            help_text="YYYY-MM-DD")
# 
#     gender = models.CharField(verbose_name=u'Gender',
#                               max_length=24, choices=GENDER_CHOICES)
# 
#     address = models.TextField(
#       blank=False, help_text="This information will be used to send "
#         "any DDs/Cheques.")
# 
#     phonenum = models.CharField(max_length = 15, blank = True,
#                                 verbose_name = u"Phone Number")
# 
#     def __unicode__(self):
#         return unicode(self.user.username)


import re
from django import forms
from django.utils.translation import ugettext
from registration.forms import RegistrationFormUniqueEmail
from registration.forms import attrs_dict
from registration.models import RegistrationProfile
from pytask.profile.models import GENDER_CHOICES, Profile

    
    def save(self, profile_callback=None):

        new_user = RegistrationProfile.objects.create_inactive_user(
                       username=self.cleaned_data['username'],
                       password=self.cleaned_data['password1'],
                       email=self.cleaned_data['email'])
        
        new_profile = Profile(user=new_user,
                              aboutme=self.cleaned_data['aboutme'],
                              dob=self.cleaned_data['dob'],
                              gender=self.cleaned_data['gender'],
                              address=self.cleaned_data['address'],
                              phonenum=self.cleaned_data['phonenum'],
                             )
        new_profile.save()

        return new_user


class CreateProfileForm(forms.ModelForm):

    class Meta:
        model = Profile
        exclude = ['pynts', 'role']

class EditProfileForm(forms.ModelForm):

    class Meta:

# Path: pytask/profile/models.py
# GENDER_CHOICES = (
#   ('Male', 'Male'),
#   ('Female', 'Female'),
# )
# 
# class Profile(models.Model):
#     full_name = models.CharField(
#       max_length=50, verbose_name="Name as on bank account",
#       help_text="Any DD/Cheque will be issued on this name")
# 
#     user = models.ForeignKey(User, unique = True)
# 
#     role = models.CharField(max_length=255,
#                             choices=ROLES_CHOICES,
#                             default=u"Contributor")
# 
#     pynts = models.PositiveSmallIntegerField(default=0)
# 
#     aboutme = models.TextField(
#       blank = True,
#       help_text="This information will be used to judge the eligibility "
#         "for any task")
# 
#     dob = models.DateField(verbose_name=u"Date of Birth",
#                            help_text="YYYY-MM-DD")
# 
#     gender = models.CharField(verbose_name=u'Gender',
#                               max_length=24, choices=GENDER_CHOICES)
# 
#     address = models.TextField(
#       blank=False, help_text="This information will be used to send "
#         "any DDs/Cheques.")
# 
#     phonenum = models.CharField(max_length = 15, blank = True,
#                                 verbose_name = u"Phone Number")
# 
#     def __unicode__(self):
#         return unicode(self.user.username)


# Path: pytask/profile/forms.py
import re
from django import forms
from django.utils.translation import ugettext
from registration.forms import RegistrationFormUniqueEmail
from registration.forms import attrs_dict
from registration.models import RegistrationProfile
from pytask.profile.models import GENDER_CHOICES, Profile


    
    def save(self, profile_callback=None):

        new_user = RegistrationProfile.objects.create_inactive_user(
                       username=self.cleaned_data['username'],
                       password=self.cleaned_data['password1'],
                       email=self.cleaned_data['email'])
        
        new_profile = Profile(user=new_user,
                              aboutme=self.cleaned_data['aboutme'],
                              dob=self.cleaned_data['dob'],
                              gender=self.cleaned_data['gender'],
                              address=self.cleaned_data['address'],
                              phonenum=self.cleaned_data['phonenum'],
                             )
        new_profile.save()

        return new_user


class CreateProfileForm(forms.ModelForm):

    class Meta:
        model = Profile
        exclude = ['pynts', 'role']

class EditProfileForm(forms.ModelForm):

    class Meta:

        model = Profile