author | Nishanth Amuluru <nishanth@fossee.in> |
Sat, 08 Jan 2011 20:55:34 +0530 | |
changeset 84 | 2120e853f10b |
parent 82 | 285320d3063c |
child 85 | 4ca185390379 |
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 |
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 | 38 |
|
39 |
class TaskComment(models.Model): |
|
40 |
||
41 |
uniq_key = models.CharField(max_length = 10, unique = True) |
|
42 |
task = models.ForeignKey('Task', related_name = "%(class)s_task") |
|
43 |
||
44 |
data = models.TextField() |
|
45 |
created_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
|
46 |
deleted_by = models.ForeignKey(User, null = True, blank = True, |
|
47 |
related_name = "%(class)s_deleted_by") |
|
48 |
creation_datetime = models.DateTimeField() |
|
49 |
is_deleted = models.BooleanField(default=False) |
|
50 |
||
51 |
def __unicode__(self): |
|
52 |
return unicode(self.task.title) |