pytask/taskapp/models.py
author Nishanth Amuluru <nishanth@fossee.in>
Sun, 09 Jan 2011 00:53:11 +0530
changeset 110 1eb24b1662cf
parent 108 8ffc889a3b37
child 113 ac75d3cfa96f
permissions -rwxr-xr-x
commenting does not need a verbose_name
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
89
539e7a0b5d86 Included the missing imports
Nishanth Amuluru <nishanth@fossee.in>
parents: 88
diff changeset
     2
from django.contrib.auth.models import User
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     3
88
8165274cafa1 eanbled taskapp and registered task model into tagging
Nishanth Amuluru <nishanth@fossee.in>
parents: 87
diff changeset
     4
import tagging
8165274cafa1 eanbled taskapp and registered task model into tagging
Nishanth Amuluru <nishanth@fossee.in>
parents: 87
diff changeset
     5
from tagging.fields import TagField
8165274cafa1 eanbled taskapp and registered task model into tagging
Nishanth Amuluru <nishanth@fossee.in>
parents: 87
diff changeset
     6
92
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
     7
TASK_STATUS_CHOICES = (
82
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
     8
        ("UP", "Unpublished"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
     9
        ("OP", "Open"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    10
        ("LO", "Locked"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    11
        ("WR", "Working"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    12
        ("CD", "Closed"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    13
        ("DL", "Deleted"),
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    14
        ("CM", "Completed"))
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    15
92
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
    16
TB_STATUS_CHOICES = (
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
    17
    ("UP", "Unpublished"),
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
    18
    ("OP", "Open"),
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
    19
    ("WR", "All tasks have users selected"),
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
    20
    ("CM", "Completed"))
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
    21
89
539e7a0b5d86 Included the missing imports
Nishanth Amuluru <nishanth@fossee.in>
parents: 88
diff changeset
    22
UPLOADS_DIR = "./pytask/static/uploads"
539e7a0b5d86 Included the missing imports
Nishanth Amuluru <nishanth@fossee.in>
parents: 88
diff changeset
    23
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    24
class Task(models.Model):
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    25
    
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    26
    uniq_key = models.CharField(max_length = 10, unique = True)
82
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    27
    title = models.CharField(max_length = 100, verbose_name = u"Title", 
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    28
                             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
    29
    desc = models.TextField(verbose_name = u"Description")
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    30
92
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
    31
    status = models.CharField(max_length = 2, choices = TASK_STATUS_CHOICES, default = "UP")
82
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    32
    tags_field = TagField(verbose_name = u"Tags", 
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    33
                          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
    34
    
82
285320d3063c finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents: 69
diff changeset
    35
    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
    36
                                             gets on completing the task")
103
e7302ae73e53 added blank=true whereever required
Nishanth Amuluru <nishanth@fossee.in>
parents: 93
diff changeset
    37
    created_by = models.ForeignKey(User,
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    38
                                   related_name = "created_tasks")
103
e7302ae73e53 added blank=true whereever required
Nishanth Amuluru <nishanth@fossee.in>
parents: 93
diff changeset
    39
    approved_by = models.ForeignKey(User, blank = True, null = True,
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    40
                                    related_name = "approved_tasks")
103
e7302ae73e53 added blank=true whereever required
Nishanth Amuluru <nishanth@fossee.in>
parents: 93
diff changeset
    41
    reviewers = models.ManyToManyField(User, blank = True, null = True,
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    42
                                       related_name = "reviewing_tasks")
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    43
103
e7302ae73e53 added blank=true whereever required
Nishanth Amuluru <nishanth@fossee.in>
parents: 93
diff changeset
    44
    claimed_users = models.ManyToManyField(User, blank = True, null = True, 
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    45
                                           related_name = "claimed_tasks")
103
e7302ae73e53 added blank=true whereever required
Nishanth Amuluru <nishanth@fossee.in>
parents: 93
diff changeset
    46
    selected_users = models.ManyToManyField(User, blank = True, null = True, 
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    47
                                            related_name = "selected_tasks")
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    48
    
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    49
    creation_datetime = models.DateTimeField()
104
2e344786ce4f added null=true for datetime
Nishanth Amuluru <nishanth@fossee.in>
parents: 103
diff changeset
    50
    approval_datetime = models.DateTimeField(blank = True, null = True)
69
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    51
    
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    52
    def __unicode__(self):
c6bca38c1cbf Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    53
        return unicode(self.title)
84
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    54
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    55
class TaskComment(models.Model):
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    56
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    57
    uniq_key = models.CharField(max_length = 10, unique = True)
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    58
    task = models.ForeignKey('Task', related_name = "comments")
84
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    59
            
110
1eb24b1662cf commenting does not need a verbose_name
Nishanth Amuluru <nishanth@fossee.in>
parents: 108
diff changeset
    60
    data = models.TextField(verbose_name="")
103
e7302ae73e53 added blank=true whereever required
Nishanth Amuluru <nishanth@fossee.in>
parents: 93
diff changeset
    61
    commented_by = models.ForeignKey(User,
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    62
                                     related_name = "commented_taskcomments")
84
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    63
    deleted_by = models.ForeignKey(User, null = True, blank = True,
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    64
                                   related_name = "deleted_taskcomments")
85
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    65
    comment_datetime = models.DateTimeField()
84
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    66
    is_deleted = models.BooleanField(default=False)
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    67
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    68
    def __unicode__(self):
2120e853f10b added comment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 82
diff changeset
    69
        return unicode(self.task.title)
85
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    70
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    71
class TaskClaim(models.Model):
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    72
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    73
    uniq_key = models.CharField(max_length = 10, unique = True)
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    74
    task = models.ForeignKey('Task', related_name = "claims")
85
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    75
            
103
e7302ae73e53 added blank=true whereever required
Nishanth Amuluru <nishanth@fossee.in>
parents: 93
diff changeset
    76
    claimed_by = models.ForeignKey(User,
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    77
                                   related_name = "claimed_claims")
85
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    78
    proposal = models.TextField()
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    79
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    80
    comment_datetime = models.DateTimeField()
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    81
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    82
    def __unicode__(self):
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    83
        return unicode(self.task.title)
4ca185390379 added claim model
Nishanth Amuluru <nishanth@fossee.in>
parents: 84
diff changeset
    84
86
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    85
class WorkReport(models.Model):
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    86
87
8f8bd185aacf Added uniq_key to report model
Nishanth Amuluru <nishanth@fossee.in>
parents: 86
diff changeset
    87
    uniq_key = models.CharField(max_length = 10, unique = True)
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    88
    task = models.ForeignKey(Task, related_name = "reports")
103
e7302ae73e53 added blank=true whereever required
Nishanth Amuluru <nishanth@fossee.in>
parents: 93
diff changeset
    89
    submitted_by = models.ForeignKey(User, null = True, blank = True,
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    90
                                     related_name = "submitted_reports")
103
e7302ae73e53 added blank=true whereever required
Nishanth Amuluru <nishanth@fossee.in>
parents: 93
diff changeset
    91
    approved_by = models.ForeignKey(User, null = True, blank = True,
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
    92
                                    related_name = "approved_reports")
86
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    93
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    94
    data = models.TextField()
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    95
    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
    96
                               help_text="A one line summary")
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    97
    attachment = models.FileField(upload_to = UPLOADS_DIR)
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    98
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
    99
    revision = models.PositiveIntegerField(default=0)
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
   100
    submitted_at = models.DateTimeField()
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
   101
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
   102
class ReportComment(models.Model):
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
   103
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
   104
    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
   105
    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
   106
            
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
   107
    data = models.TextField()
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
   108
    commented_by = models.ForeignKey(User, 
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
   109
                                     related_name = "commented_reportcomments")
86
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
   110
    deleted_by = models.ForeignKey(User, null = True, blank = True,
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
   111
                                   related_name = "deleted_reportcomments")
86
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
   112
    comment_datetime = models.DateTimeField()
2f20098f2da3 created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents: 85
diff changeset
   113
    is_deleted = models.BooleanField(default=False)
88
8165274cafa1 eanbled taskapp and registered task model into tagging
Nishanth Amuluru <nishanth@fossee.in>
parents: 87
diff changeset
   114
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
   115
class PyntRequests(models.Model):
90
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   116
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   117
    uniq_key = models.CharField(max_length = 10, unique = True)
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
   118
    task = models.ForeignKey(Task, related_name = "pynt_requests")
90
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   119
    pynts = models.PositiveIntegerField(default=0, help_text="No.of pynts")
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   120
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   121
    requested_by = models.ForeignKey(User, 
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
   122
                                     related_name = "requested_by_pynts")
90
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   123
    requested_for = models.ForeignKey(User, 
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
   124
                                     related_name = "requested_for_pynts")
90
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   125
103
e7302ae73e53 added blank=true whereever required
Nishanth Amuluru <nishanth@fossee.in>
parents: 93
diff changeset
   126
    responded_by = models.ForeignKey(User, null = True, blank = True,
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
   127
                                    related_name = "responded_requests")
90
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   128
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   129
    is_accepted = models.BooleanField(default=False)
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   130
    remarks = models.CharField(max_length=100, blank=True,
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   131
                               help_text="Reason in case of rejection")
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   132
            
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   133
    request_datetime = models.DateTimeField()
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   134
    is_responded = models.BooleanField(default=False)
437af7ad6cb9 added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents: 89
diff changeset
   135
92
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
   136
class TextBook(models.Model):
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
   137
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
   138
    uniq_key = models.CharField(max_length = 10, unique = True)
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
   139
    chapters = models.ManyToManyField(Task, related_name="%(class)s_set")
92
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
   140
    tags_field = TagField(verbose_name="Tags")
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
   141
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
   142
    created_by = models.ForeignKey(User, related_name = "created_textbooks")
103
e7302ae73e53 added blank=true whereever required
Nishanth Amuluru <nishanth@fossee.in>
parents: 93
diff changeset
   143
    approved_by = models.ForeignKey(User, null = True, blank = True,
108
8ffc889a3b37 renamed all the related_name fields for better readability
Nishanth Amuluru <nishanth@fossee.in>
parents: 104
diff changeset
   144
                                    related_name = "approved_textbooks")
92
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
   145
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
   146
    status = models.CharField(max_length = 2, choices = TB_STATUS_CHOICES, default = "UP")
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
   147
    creation_datetime = models.DateTimeField()
104
2e344786ce4f added null=true for datetime
Nishanth Amuluru <nishanth@fossee.in>
parents: 103
diff changeset
   148
    approval_datetime = models.DateTimeField(blank = True, null = True)
92
b92347d24557 Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents: 90
diff changeset
   149
88
8165274cafa1 eanbled taskapp and registered task model into tagging
Nishanth Amuluru <nishanth@fossee.in>
parents: 87
diff changeset
   150
tagging.register(Task)