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