taskapp/models.py
author nishanth
Thu, 04 Feb 2010 19:42:35 +0530
changeset 10 bf0cbea1bd12
parent 1 7818992cbf83
child 12 a93eebabfeb1
permissions -rw-r--r--
removed views.py and made it a package. added auth_profile to settings.py
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"),
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
     9
	("CT", "Contributor"),)
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
    10
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
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
    12
	("OP", "Open"),
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    13
    ("LO", "Locked"),
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
    14
	("CL", "Claimed"),
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    15
	("AS", "Assigned"),
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    16
    ("RO", "Reopened"),
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    17
    ("CD", "Closed"),
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    18
    ("DL", "Deleted"),
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    19
    ("CM", "Completed"))
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
    20
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
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
    22
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
    23
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    24
class Profile(models.Model):
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
    25
	
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
    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
    27
    aboutme = models.TextField()
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    28
    dob = models.DateField()
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
    29
    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
    30
    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
    31
    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
    32
    
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
    foss_comm = models.CharField(max_length = 80, blank = True)
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    34
    phonenum = models.CharField(max_length = 15, blank = True)
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
    35
    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
    36
    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
    37
    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
    38
    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
    39
    nick = models.CharField(max_length = 20, blank = True)
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    40
#    photo = models.ImageField(upload_to = IMAGES_DIR, blank = True)
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
    41
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
    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
    43
        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
    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
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
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
    47
    
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
    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
    49
    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
    50
    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
    51
    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
    52
    
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    53
    subs = models.ManyToManyField('self', blank = True, related_name = "%(class)s_parents")
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
    54
    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
    55
    
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
    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
    57
    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
    58
        
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    59
    mentors = models.ManyToManyField(User, related_name = "%(class)s_mentors")
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    60
    created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    61
    claimed_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_claimed_users")
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    62
    assigned_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_assigned_users")
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
    63
    
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    64
    creation_datetime = models.DateTimeField()
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
    65
    
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
    ## 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
    67
    ## 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
    68
    ## 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
    69
    
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
    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
    71
        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
    72
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
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
    74
    
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
    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
    76
    data = models.TextField()
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    77
    created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    78
    creation_datetime = models.DateTimeField()
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    79
#    deleted_by = models.ForeignKey(User, null = True, blank = True, related_name = "%(class)s_deleted_by")
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    80
#    deleted = models.BooleanField()
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    81
#    attachment = models.FileField(upload_to = UPLOADS_DIR, blank = True)
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
    82
    
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
    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
    84
        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
    85
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
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
    87
    
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
    task = models.ForeignKey('Task')
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    89
    given_by = models.ForeignKey(User, related_name = "%(class)s_given_by")
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    90
    given_to = models.ForeignKey(User, related_name = "%(class)s_given_to")
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
    91
    points = models.PositiveSmallIntegerField()
10
bf0cbea1bd12 removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents: 1
diff changeset
    92
    given_time = models.DateTimeField()
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
    93
    
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
    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
    95
        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
    96