author | Nishanth Amuluru <nishanth@fossee.in> |
Sat, 08 Jan 2011 22:05:45 +0530 | |
changeset 93 | 54152e4f5cd7 |
parent 92 | b92347d24557 |
child 103 | e7302ae73e53 |
permissions | -rwxr-xr-x |
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") |
69
c6bca38c1cbf
Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff
changeset
|
37 |
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
|
38 |
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
|
39 |
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
|
40 |
|
82
285320d3063c
finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents:
69
diff
changeset
|
41 |
claimed_users = models.ManyToManyField(User, blank = True, |
285320d3063c
finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents:
69
diff
changeset
|
42 |
related_name = "%(class)s_claimed_users") |
285320d3063c
finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents:
69
diff
changeset
|
43 |
selected_users = models.ManyToManyField(User, blank = True, |
285320d3063c
finalised the task model
Nishanth Amuluru <nishanth@fossee.in>
parents:
69
diff
changeset
|
44 |
related_name = "%(class)s_selected_users") |
69
c6bca38c1cbf
Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff
changeset
|
45 |
|
c6bca38c1cbf
Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff
changeset
|
46 |
creation_datetime = models.DateTimeField() |
92
b92347d24557
Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents:
90
diff
changeset
|
47 |
approval_datetime = models.DateTimeField() |
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 |
def __unicode__(self): |
c6bca38c1cbf
Added buildout stuff and made changes accordingly
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff
changeset
|
50 |
return unicode(self.title) |
84 | 51 |
|
52 |
class TaskComment(models.Model): |
|
53 |
||
54 |
uniq_key = models.CharField(max_length = 10, unique = True) |
|
55 |
task = models.ForeignKey('Task', related_name = "%(class)s_task") |
|
56 |
||
57 |
data = models.TextField() |
|
85 | 58 |
commented_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
84 | 59 |
deleted_by = models.ForeignKey(User, null = True, blank = True, |
60 |
related_name = "%(class)s_deleted_by") |
|
85 | 61 |
comment_datetime = models.DateTimeField() |
84 | 62 |
is_deleted = models.BooleanField(default=False) |
63 |
||
64 |
def __unicode__(self): |
|
65 |
return unicode(self.task.title) |
|
85 | 66 |
|
67 |
class TaskClaim(models.Model): |
|
68 |
||
69 |
uniq_key = models.CharField(max_length = 10, unique = True) |
|
70 |
task = models.ForeignKey('Task', related_name = "%(class)s_task") |
|
71 |
||
72 |
claimed_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
|
73 |
proposal = models.TextField() |
|
74 |
||
75 |
comment_datetime = models.DateTimeField() |
|
76 |
is_deleted = models.BooleanField(default=False) |
|
77 |
||
78 |
def __unicode__(self): |
|
79 |
return unicode(self.task.title) |
|
80 |
||
86
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
81 |
class WorkReport(models.Model): |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
82 |
|
87
8f8bd185aacf
Added uniq_key to report model
Nishanth Amuluru <nishanth@fossee.in>
parents:
86
diff
changeset
|
83 |
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
|
84 |
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
|
85 |
submitted_by = models.ForeignKey(User, |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
86 |
related_name = "%(class)s_submitted_by") |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
87 |
approved_by = models.ForeignKey(User, |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
88 |
related_name = "%(class)s_approved_by") |
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 |
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
|
92 |
help_text="A one line summary") |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
93 |
attachment = models.FileField(upload_to = UPLOADS_DIR) |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
94 |
|
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
95 |
revision = models.PositiveIntegerField(default=0) |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
96 |
submitted_at = models.DateTimeField() |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
97 |
|
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
98 |
class ReportComment(models.Model): |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
99 |
|
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
100 |
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
|
101 |
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
|
102 |
|
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
103 |
data = models.TextField() |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
104 |
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
|
105 |
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
|
106 |
related_name = "%(class)s_deleted_by") |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
107 |
comment_datetime = models.DateTimeField() |
2f20098f2da3
created work report model and reportcomment model
Nishanth Amuluru <nishanth@fossee.in>
parents:
85
diff
changeset
|
108 |
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
|
109 |
|
90
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
110 |
class RequestPynts(models.Model): |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
111 |
|
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
112 |
uniq_key = models.CharField(max_length = 10, unique = True) |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
113 |
task = models.ForeignKey(Task, related_name = "%(class)s_task") |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
114 |
pynts = models.PositiveIntegerField(default=0, help_text="No.of pynts") |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
115 |
|
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
116 |
requested_by = models.ForeignKey(User, |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
117 |
related_name = "%(class)s_requested_by") |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
118 |
requested_for = models.ForeignKey(User, |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
119 |
related_name = "%(class)s_requested_for") |
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 |
responded_by = models.ForeignKey(User, |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
122 |
related_name = "%(class)s_responded_by") |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
123 |
|
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
124 |
is_accepted = models.BooleanField(default=False) |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
125 |
remarks = models.CharField(max_length=100, blank=True, |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
126 |
help_text="Reason in case of rejection") |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
127 |
|
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
128 |
request_datetime = models.DateTimeField() |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
129 |
is_responded = models.BooleanField(default=False) |
437af7ad6cb9
added request pynts model
Nishanth Amuluru <nishanth@fossee.in>
parents:
89
diff
changeset
|
130 |
|
92
b92347d24557
Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents:
90
diff
changeset
|
131 |
class TextBook(models.Model): |
b92347d24557
Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents:
90
diff
changeset
|
132 |
|
b92347d24557
Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents:
90
diff
changeset
|
133 |
uniq_key = models.CharField(max_length = 10, unique = True) |
93
54152e4f5cd7
added the most important field. The chapters
Nishanth Amuluru <nishanth@fossee.in>
parents:
92
diff
changeset
|
134 |
chapters = models.ManyToManyField(Task, related_name="%(class)s_chapters") |
92
b92347d24557
Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents:
90
diff
changeset
|
135 |
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
|
136 |
|
b92347d24557
Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents:
90
diff
changeset
|
137 |
created_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
b92347d24557
Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents:
90
diff
changeset
|
138 |
approved_by = models.ForeignKey(User, related_name = "%(class)s_approved_by") |
b92347d24557
Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents:
90
diff
changeset
|
139 |
|
b92347d24557
Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents:
90
diff
changeset
|
140 |
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
|
141 |
creation_datetime = models.DateTimeField() |
b92347d24557
Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents:
90
diff
changeset
|
142 |
approval_datetime = models.DateTimeField() |
b92347d24557
Added textbook model and made a few small changes
Nishanth Amuluru <nishanth@fossee.in>
parents:
90
diff
changeset
|
143 |
|
88
8165274cafa1
eanbled taskapp and registered task model into tagging
Nishanth Amuluru <nishanth@fossee.in>
parents:
87
diff
changeset
|
144 |
tagging.register(Task) |