profile/models.py
author Nishanth Amuluru <nishanth@fossee.in>
Thu, 06 Jan 2011 16:48:29 +0530
changeset 242 93bee6c96c35
parent 241 479cbf5c822a
child 243 4c3aff34ae9c
permissions -rwxr-xr-x
Added the model for holding user info
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
241
479cbf5c822a Added an app called profile to manage user profiles
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     1
from django.db import models
479cbf5c822a Added an app called profile to manage user profiles
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     2
242
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     3
from django.contrib.auth.models import User
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     4
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     5
GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female'))
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     6
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     7
RIGHTS_CHOICES = (
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     8
	("DC", "Director"),
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
     9
	("MG", "Manager"),
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    10
	("CT", "Contributor"),)
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    11
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    12
class Profile(models.Model):
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    13
    
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    14
    user = models.ForeignKey(User, unique = True)
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    15
    rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT")
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    16
    pynts = models.PositiveSmallIntegerField(default = 0)
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    17
    
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    18
    aboutme = models.TextField(blank = True, help_text="This information will\
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    19
                               be used to judge the eligibility for any task")
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    20
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    21
    dob = models.DateField(verbose_name = u"Date of Birth", help_text = "YYYY-MM-DD")
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    22
    gender = models.CharField(max_length = 1, choices = GENDER_CHOICES)
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    23
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    24
    address = models.TextField(blank = False, help_text="This information will\
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    25
                               be used to send any DDs/Cheques")
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    26
    phonenum = models.CharField(max_length = 15, blank = True, verbose_name = u"Phone Number")
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    27
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    28
    def __unicode__(self):
93bee6c96c35 Added the model for holding user info
Nishanth Amuluru <nishanth@fossee.in>
parents: 241
diff changeset
    29
        return unicode(self.user.username)