pytask/taskapp/models.py
author Nishanth Amuluru <nishanth@fossee.in>
Sat, 08 Jan 2011 20:58:17 +0530
changeset 85 4ca185390379
parent 84 2120e853f10b
child 86 2f20098f2da3
permissions -rwxr-xr-x
added claim model
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     1
from django.db import models
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     2
82
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
     3
STATUS_CHOICES = (
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
     4
        ("UP", "Unpublished"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
     5
        ("OP", "Open"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
     6
        ("LO", "Locked"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
     7
        ("WR", "Working"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
     8
        ("CD", "Closed"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
     9
        ("DL", "Deleted"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    10
        ("CM", "Completed"))
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    11
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    12
class Task(models.Model):
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    13
    
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    14
    uniq_key = models.CharField(max_length = 10, unique = True)
82
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    15
    title = models.CharField(max_length = 100, verbose_name = u"Title", 
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    16
                             help_text = u"Keep it simple and below 100 chars.")
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    17
    desc = models.TextField(verbose_name = u"Description")
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    18
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    19
    status = models.CharField(max_length = 2, choices = STATUS_CHOICES, default = "UP")
82
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    20
    tags_field = TagField(verbose_name = u"Tags", 
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    21
                          help_text = u"Give tags seperated by commas") 
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    22
    
82
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    23
    pynts = models.PositiveSmallIntegerField(help_text = u"No.of pynts a user \
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    24
                                             gets on completing the task")
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    25
    created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
82
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    26
    approved_by = models.ForeignKey(User, related_name = "%(class)s_approved_by")
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    27
    reviewers = models.ManyToManyField(User, related_name = "%(class)s_reviewers")
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    28
82
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    29
    claimed_users = models.ManyToManyField(User, blank = True, 
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    30
                                           related_name = "%(class)s_claimed_users")
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    31
    selected_users = models.ManyToManyField(User, blank = True, 
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    32
                                            related_name = "%(class)s_selected_users")
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    33
    
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    34
    creation_datetime = models.DateTimeField()
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    35
    
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    36
    def __unicode__(self):
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    37
        return unicode(self.title)
84
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    38
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    39
class TaskComment(models.Model):
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    40
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    41
    uniq_key = models.CharField(max_length = 10, unique = True)
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    42
    task = models.ForeignKey('Task', related_name = "%(class)s_task")
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    43
            
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    44
    data = models.TextField()
85
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    45
    commented_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
84
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    46
    deleted_by = models.ForeignKey(User, null = True, blank = True,
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    47
                                   related_name = "%(class)s_deleted_by")
85
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    48
    comment_datetime = models.DateTimeField()
84
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    49
    is_deleted = models.BooleanField(default=False)
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    50
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    51
    def __unicode__(self):
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    52
        return unicode(self.task.title)
85
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    53
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    54
class TaskClaim(models.Model):
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    55
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    56
    uniq_key = models.CharField(max_length = 10, unique = True)
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    57
    task = models.ForeignKey('Task', related_name = "%(class)s_task")
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    58
            
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    59
    claimed_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    60
    proposal = models.TextField()
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    61
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    62
    comment_datetime = models.DateTimeField()
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    63
    is_deleted = models.BooleanField(default=False)
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    64
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    65
    def __unicode__(self):
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    66
        return unicode(self.task.title)
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    67