author | nishanth |
Fri, 29 Jan 2010 23:34:19 +0530 | |
changeset 10 | c2001db39937 |
parent 5 | aea7e764c033 |
child 11 | d28fcc644fbb |
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 = ( |
|
12 |
("OP", "Open"), |
|
13 |
("LO", "Locked"), |
|
14 |
("CL", "Claimed"), |
|
15 |
("AS", "Assigned"), |
|
16 |
("RO", "Reopened"), |
|
17 |
("CD", "Closed"), |
|
18 |
("DL", "Deleted"), |
|
19 |
("CM", "Completed")) |
|
20 |
||
21 |
IMAGES_DIR = "./images" |
|
22 |
UPLOADS_DIR = "./uploads" |
|
23 |
||
24 |
class Profile(models.Model): |
|
25 |
||
26 |
user = models.ForeignKey(User, unique = True) |
|
5
aea7e764c033
created views and templates for homepage,browse_task and added actions.
nishanth
parents:
2
diff
changeset
|
27 |
dob = models.DateField(help_text = "YYYY-MM-DD") |
2 | 28 |
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
|
29 |
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
|
30 |
credits = models.PositiveSmallIntegerField(default = 0) |
2 | 31 |
|
5
aea7e764c033
created views and templates for homepage,browse_task and added actions.
nishanth
parents:
2
diff
changeset
|
32 |
aboutme = models.TextField(blank = True) |
2 | 33 |
foss_comm = models.CharField(max_length = 80, blank = True) |
34 |
phonenum = models.CharField(max_length = 15, blank = True) |
|
35 |
homepage = models.URLField(blank = True) |
|
36 |
street = models.CharField(max_length = 80, blank = True) |
|
37 |
city = models.CharField(max_length = 25, blank = True) |
|
38 |
country = models.CharField(max_length = 25, blank = True) |
|
39 |
nick = models.CharField(max_length = 20, blank = True) |
|
40 |
# photo = models.ImageField(upload_to = IMAGES_DIR, blank = True) |
|
41 |
||
42 |
def __unicode__(self): |
|
43 |
return unicode(self.user.username) |
|
44 |
||
45 |
||
46 |
class Task(models.Model): |
|
47 |
||
48 |
title = models.CharField(max_length = 200, unique = True) |
|
49 |
desc = models.TextField() |
|
50 |
status = models.CharField(max_length = 2, choices = STATUS_CHOICES) |
|
51 |
tags = models.CharField(max_length = 200, blank = True) |
|
52 |
||
53 |
subs = models.ManyToManyField('self', blank = True, related_name = "%(class)s_parents") |
|
54 |
deps = models.ManyToManyField('self', blank = True, related_name = "%(class)s_deps") |
|
55 |
||
56 |
credits = models.PositiveSmallIntegerField() |
|
57 |
progress = models.PositiveSmallIntegerField() |
|
58 |
||
59 |
mentors = models.ManyToManyField(User, related_name = "%(class)s_mentors") |
|
60 |
created_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
|
61 |
claimed_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_claimed_users") |
|
62 |
assigned_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_assigned_users") |
|
63 |
||
64 |
creation_datetime = models.DateTimeField() |
|
65 |
||
5
aea7e764c033
created views and templates for homepage,browse_task and added actions.
nishanth
parents:
2
diff
changeset
|
66 |
#is_claimable = models.BooleanField() |
aea7e764c033
created views and templates for homepage,browse_task and added actions.
nishanth
parents:
2
diff
changeset
|
67 |
|
2 | 68 |
## not yet decided if attribs after this are to be included |
69 |
## tasktype = "" ## "bugfix"/"enhancement" |
|
70 |
## priority = "" ## "very urgent"/"urgent" |
|
71 |
||
72 |
def __unicode__(self): |
|
73 |
return unicode(self.title) |
|
74 |
||
75 |
class Comment(models.Model): |
|
76 |
||
77 |
task = models.ForeignKey('Task') |
|
78 |
data = models.TextField() |
|
79 |
created_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
|
80 |
creation_datetime = models.DateTimeField() |
|
81 |
# deleted_by = models.ForeignKey(User, null = True, blank = True, related_name = "%(class)s_deleted_by") |
|
82 |
# deleted = models.BooleanField() |
|
83 |
# attachment = models.FileField(upload_to = UPLOADS_DIR, blank = True) |
|
84 |
||
85 |
def __unicode__(self): |
|
86 |
return unicode(self.task.title) |
|
87 |
||
88 |
class Credit(models.Model): |
|
89 |
||
90 |
task = models.ForeignKey('Task') |
|
91 |
given_by = models.ForeignKey(User, related_name = "%(class)s_given_by") |
|
92 |
given_to = models.ForeignKey(User, related_name = "%(class)s_given_to") |
|
93 |
points = models.PositiveSmallIntegerField() |
|
94 |
given_time = models.DateTimeField() |
|
95 |
||
96 |
def __unicode__(self): |
|
97 |
return unicode(self.task.title) |
|
98 |