taskapp/models.py
author Nishanth <nishanth@fossee.in>
Sun, 24 Jan 2010 15:43:19 +0530
changeset 1 7818992cbf83
child 9 3ad980fc23ca
permissions -rw-r--r--
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     1
from django.db import models
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     2
from django.contrib.auth.models import User
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     3
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     4
GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female'))
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     5
RIGHTS_CHOICES = (
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     6
	("AD", "Admin"),
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     7
	("MN", "Manager"),
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     8
	("DV", "Developer"),
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     9
	("MT", "Mentor"),
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    10
	("CT", "Contributor"),
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    11
	("GP", "Public"),)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    12
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    13
STATUS_CHOICES = (
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    14
	("OP", "Open"),
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    15
	("CL", "Claimed"),
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    16
	("LO", "Locked"),
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    17
	("AS", "Assigned"),)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    18
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    19
IMAGES_DIR = "./images"
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    20
UPLOADS_DIR = "./uploads"
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    21
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    22
class Person(models.Model):
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    23
#class Person(User):
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    24
	
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    25
    user = models.ForeignKey(User, unique = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    26
    aboutme = models.TextField()
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    27
    DOB = models.DateField()
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    28
    gender = models.CharField(max_length = 1, choices = GENDER_CHOICES)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    29
    rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    30
    credits = models.PositiveSmallIntegerField()
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    31
    
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    32
    foss_comm = models.CharField(max_length = 80, blank = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    33
    phoneNum = models.CharField(max_length = 15, blank = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    34
    homepage = models.URLField(blank = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    35
    street = models.CharField(max_length = 80, blank = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    36
    city = models.CharField(max_length = 25, blank = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    37
    country = models.CharField(max_length = 25, blank = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    38
    nick = models.CharField(max_length = 20, blank = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    39
    photo = models.ImageField(upload_to = IMAGES_DIR, blank = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    40
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    41
    def __unicode__(self):
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    42
        return unicode(self.user.username)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    43
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    44
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    45
class Task(models.Model):
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    46
    
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    47
    title = models.CharField(max_length = 200, unique = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    48
    desc = models.TextField()
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    49
    status = models.CharField(max_length = 2, choices = STATUS_CHOICES)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    50
    tags = models.CharField(max_length = 200, blank = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    51
    
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    52
    parents = models.ManyToManyField('self', blank = True, related_name = "%(class)s_parents")
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    53
    deps = models.ManyToManyField('self', blank = True, related_name = "%(class)s_deps")
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    54
    
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    55
    credits = models.PositiveSmallIntegerField()
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    56
    progress = models.PositiveSmallIntegerField()
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    57
        
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    58
    mentors = models.ManyToManyField('Person', related_name = "%(class)s_mentors")
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    59
    created_by = models.ForeignKey('Person', related_name = "%(class)s_created_by")
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    60
    claimed_users = models.ManyToManyField('Person', blank = True, related_name = "%(class)s_claimed_users")
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    61
    assigned_users = models.ManyToManyField('Person', blank = True, related_name = "%(class)s_assigned_users")
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    62
    
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    63
    creation_date = models.DateField()
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    64
    
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    65
    ## not yet decided if attribs after this are to be included
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    66
    ## tasktype = "" ## "bugfix"/"enhancement"
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    67
    ## priority = "" ## "very urgent"/"urgent"
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    68
    
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    69
    def __unicode__(self):
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    70
        return unicode(self.title)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    71
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    72
class Comment(models.Model):
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    73
    
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    74
    task = models.ForeignKey('Task')
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    75
    data = models.TextField()
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    76
    created_by = models.ForeignKey('Person', related_name = "%(class)s_created_by")
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    77
    deleted_by = models.ForeignKey('Person', null = True, blank = True, related_name = "%(class)s_deleted_by")
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    78
    creation_date = models.DateField()
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    79
    deleted = models.BooleanField()
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    80
    attachment = models.FileField(upload_to = UPLOADS_DIR, blank = True)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    81
    
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    82
    def __unicode__(self):
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    83
        return unicode(self.task.title)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    84
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    85
class Credit(models.Model):
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    86
    
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    87
    task = models.ForeignKey('Task')
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    88
    given_by = models.ForeignKey('Person', related_name = "%(class)s_given_by")
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    89
    given_to = models.ForeignKey('Person', related_name = "%(class)s_given_to")
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    90
    points = models.PositiveSmallIntegerField()
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    91
    
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    92
    def __unicode__(self):
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    93
        return unicode(self.task.title)
7818992cbf83 Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff changeset
    94