author | anoop |
Mon, 01 Feb 2010 14:14:04 +0530 | |
changeset 17 | 9ca9f98af0eb |
parent 15 | c6038cbf8a39 |
permissions | -rw-r--r-- |
2 | 1 |
from django.db import models |
2 |
from django.contrib.auth.models import User |
|
3 |
||
4 |
GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female')) |
|
5 |
RIGHTS_CHOICES = ( |
|
6 |
("AD", "Admin"), |
|
7 |
("MN", "Manager"), |
|
8 |
("DV", "Developer"), |
|
9 |
("CT", "Contributor"),) |
|
10 |
||
11 |
STATUS_CHOICES = ( |
|
11
d28fcc644fbb
implemented create task view which needed task.py in events. added a method show_msg to views/user.py and used it in logoff view.
nishanth
parents:
5
diff
changeset
|
12 |
("UP", "Unpublished"), |
2 | 13 |
("OP", "Open"), |
14 |
("LO", "Locked"), |
|
15 |
("CL", "Claimed"), |
|
16 |
("AS", "Assigned"), |
|
15 | 17 |
("RE", "Reopened"), |
2 | 18 |
("CD", "Closed"), |
19 |
("DL", "Deleted"), |
|
20 |
("CM", "Completed")) |
|
21 |
||
22 |
IMAGES_DIR = "./images" |
|
23 |
UPLOADS_DIR = "./uploads" |
|
24 |
||
25 |
class Profile(models.Model): |
|
26 |
||
27 |
user = models.ForeignKey(User, unique = True) |
|
5
aea7e764c033
created views and templates for homepage,browse_task and added actions.
nishanth
parents:
2
diff
changeset
|
28 |
dob = models.DateField(help_text = "YYYY-MM-DD") |
2 | 29 |
gender = models.CharField(max_length = 1, choices = GENDER_CHOICES) |
5
aea7e764c033
created views and templates for homepage,browse_task and added actions.
nishanth
parents:
2
diff
changeset
|
30 |
rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT") |
aea7e764c033
created views and templates for homepage,browse_task and added actions.
nishanth
parents:
2
diff
changeset
|
31 |
credits = models.PositiveSmallIntegerField(default = 0) |
2 | 32 |
|
5
aea7e764c033
created views and templates for homepage,browse_task and added actions.
nishanth
parents:
2
diff
changeset
|
33 |
aboutme = models.TextField(blank = True) |
2 | 34 |
foss_comm = models.CharField(max_length = 80, blank = True) |
35 |
phonenum = models.CharField(max_length = 15, blank = True) |
|
36 |
homepage = models.URLField(blank = True) |
|
37 |
street = models.CharField(max_length = 80, blank = True) |
|
38 |
city = models.CharField(max_length = 25, blank = True) |
|
39 |
country = models.CharField(max_length = 25, blank = True) |
|
40 |
nick = models.CharField(max_length = 20, blank = True) |
|
41 |
# photo = models.ImageField(upload_to = IMAGES_DIR, blank = True) |
|
42 |
||
43 |
def __unicode__(self): |
|
44 |
return unicode(self.user.username) |
|
45 |
||
46 |
||
47 |
class Task(models.Model): |
|
48 |
||
49 |
title = models.CharField(max_length = 200, unique = True) |
|
50 |
desc = models.TextField() |
|
11
d28fcc644fbb
implemented create task view which needed task.py in events. added a method show_msg to views/user.py and used it in logoff view.
nishanth
parents:
5
diff
changeset
|
51 |
status = models.CharField(max_length = 2, choices = STATUS_CHOICES, default = "UP") |
2 | 52 |
tags = models.CharField(max_length = 200, blank = True) |
53 |
||
54 |
subs = models.ManyToManyField('self', blank = True, related_name = "%(class)s_parents") |
|
55 |
deps = models.ManyToManyField('self', blank = True, related_name = "%(class)s_deps") |
|
56 |
||
57 |
credits = models.PositiveSmallIntegerField() |
|
11
d28fcc644fbb
implemented create task view which needed task.py in events. added a method show_msg to views/user.py and used it in logoff view.
nishanth
parents:
5
diff
changeset
|
58 |
progress = models.PositiveSmallIntegerField(default = 0) |
2 | 59 |
|
60 |
mentors = models.ManyToManyField(User, related_name = "%(class)s_mentors") |
|
61 |
created_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
|
62 |
claimed_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_claimed_users") |
|
63 |
assigned_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_assigned_users") |
|
64 |
||
65 |
creation_datetime = models.DateTimeField() |
|
66 |
||
5
aea7e764c033
created views and templates for homepage,browse_task and added actions.
nishanth
parents:
2
diff
changeset
|
67 |
#is_claimable = models.BooleanField() |
aea7e764c033
created views and templates for homepage,browse_task and added actions.
nishanth
parents:
2
diff
changeset
|
68 |
|
2 | 69 |
## not yet decided if attribs after this are to be included |
70 |
## tasktype = "" ## "bugfix"/"enhancement" |
|
71 |
## priority = "" ## "very urgent"/"urgent" |
|
72 |
||
73 |
def __unicode__(self): |
|
74 |
return unicode(self.title) |
|
75 |
||
76 |
class Comment(models.Model): |
|
77 |
||
78 |
task = models.ForeignKey('Task') |
|
79 |
data = models.TextField() |
|
80 |
created_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
|
81 |
creation_datetime = models.DateTimeField() |
|
82 |
# deleted_by = models.ForeignKey(User, null = True, blank = True, related_name = "%(class)s_deleted_by") |
|
83 |
# deleted = models.BooleanField() |
|
84 |
# attachment = models.FileField(upload_to = UPLOADS_DIR, blank = True) |
|
85 |
||
86 |
def __unicode__(self): |
|
87 |
return unicode(self.task.title) |
|
88 |
||
89 |
class Credit(models.Model): |
|
90 |
||
91 |
task = models.ForeignKey('Task') |
|
92 |
given_by = models.ForeignKey(User, related_name = "%(class)s_given_by") |
|
93 |
given_to = models.ForeignKey(User, related_name = "%(class)s_given_to") |
|
94 |
points = models.PositiveSmallIntegerField() |
|
95 |
given_time = models.DateTimeField() |
|
96 |
||
97 |
def __unicode__(self): |
|
98 |
return unicode(self.task.title) |
|
14
f2623fb8041a
implemented add another mentor functionality to a task.
nishanth
parents:
11
diff
changeset
|
99 |
|
f2623fb8041a
implemented add another mentor functionality to a task.
nishanth
parents:
11
diff
changeset
|
100 |
class Claim(models.Model): |
2 | 101 |
|
14
f2623fb8041a
implemented add another mentor functionality to a task.
nishanth
parents:
11
diff
changeset
|
102 |
task = models.ForeignKey('Task') |
f2623fb8041a
implemented add another mentor functionality to a task.
nishanth
parents:
11
diff
changeset
|
103 |
user = models.ForeignKey(User) |
f2623fb8041a
implemented add another mentor functionality to a task.
nishanth
parents:
11
diff
changeset
|
104 |
message = models.TextField() |
f2623fb8041a
implemented add another mentor functionality to a task.
nishanth
parents:
11
diff
changeset
|
105 |
creation_datetime = models.DateTimeField() |
f2623fb8041a
implemented add another mentor functionality to a task.
nishanth
parents:
11
diff
changeset
|
106 |