pytask/taskapp/models.py
author Nishanth Amuluru <nishanth@fossee.in>
Sat, 08 Jan 2011 21:09:07 +0530
changeset 87 8f8bd185aacf
parent 86 2f20098f2da3
child 88 8165274cafa1
permissions -rwxr-xr-x
Added uniq_key to report 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
86
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    68
class WorkReport(models.Model):
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    69
87
8f8bd185aacf Added uniq_key to report model
Nishanth Amuluru <nishanth@fossee.in>
parents: 86
diff changeset
    70
    uniq_key = models.CharField(max_length = 10, unique = True)
86
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    71
    task = models.ForeignKey(Task, related_name = "%(class)s_task")
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    72
    submitted_by = models.ForeignKey(User, 
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    73
                                     related_name = "%(class)s_submitted_by")
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    74
    approved_by = models.ForeignKey(User, 
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    75
                                    related_name = "%(class)s_approved_by")
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    76
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    77
    data = models.TextField()
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    78
    summary = models.CharField(max_length=100, verbose_name="Summary",
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    79
                               help_text="A one line summary")
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    80
    attachment = models.FileField(upload_to = UPLOADS_DIR)
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    81
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    82
    revision = models.PositiveIntegerField(default=0)
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    83
    submitted_at = models.DateTimeField()
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    84
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    85
class ReportComment(models.Model):
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    86
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    87
    uniq_key = models.CharField(max_length = 10, unique = True)
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    88
    report = models.ForeignKey('WorkReport', related_name = "%(class)s_report")
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    89
            
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    90
    data = models.TextField()
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    91
    commented_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    92
    deleted_by = models.ForeignKey(User, null = True, blank = True,
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    93
                                   related_name = "%(class)s_deleted_by")
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    94
    comment_datetime = models.DateTimeField()
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    95
    is_deleted = models.BooleanField(default=False)