# 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
__authors__ = [
    '"Madhusudan.C.S" <madhusudancs@fossee.in>',
    '"Nishanth Amuluru" <nishanth@fossee.in>',
    ]






class CustomRegistrationForm(RegistrationFormUniqueEmail):
    """Used instead of RegistrationForm used by default django-registration
    backend, this adds aboutme, dob, gender, address, phonenum to the default 
    django-registration RegistrationForm"""

    # overriding only this field from the parent Form Class since we 
    # don't like the restriction imposed by the registration app on username
    # GMail has more or less set the standard for user names
    username = forms.CharField(
      max_length=30, widget=forms.TextInput(attrs=attrs_dict),
      label=ugettext('Username'), help_text='Username can contain alphabet, '
      'numbers or special characters underscore (_) and (.)')

    full_name = forms.CharField(required=True, max_length=50, 
                                label="Name as on your bank account", 
                                help_text="Any DD/Cheque will be issued on \
                                           this name")

    aboutme = forms.CharField(required=True, widget=forms.Textarea, 
                              max_length=1000, label=u"About Me",

# 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

__authors__ = [
    '"Madhusudan.C.S" <madhusudancs@fossee.in>',
    '"Nishanth Amuluru" <nishanth@fossee.in>',
    ]






class CustomRegistrationForm(RegistrationFormUniqueEmail):
    """Used instead of RegistrationForm used by default django-registration
    backend, this adds aboutme, dob, gender, address, phonenum to the default 
    django-registration RegistrationForm"""

    # overriding only this field from the parent Form Class since we 
    # don't like the restriction imposed by the registration app on username
    # GMail has more or less set the standard for user names
    username = forms.CharField(
      max_length=30, widget=forms.TextInput(attrs=attrs_dict),
      label=ugettext('Username'), help_text='Username can contain alphabet, '
      'numbers or special characters underscore (_) and (.)')

    full_name = forms.CharField(required=True, max_length=50, 
                                label="Name as on your bank account", 
                                help_text="Any DD/Cheque will be issued on \
                                           this name")

    aboutme = forms.CharField(required=True, widget=forms.Textarea, 
                              max_length=1000, label=u"About Me",

                              help_text="A write up about yourself to aid the\