author | nishanth |
Sat, 27 Feb 2010 14:22:26 +0530 | |
changeset 129 | e747da8bc110 |
parent 128 | f34e3a3e1439 |
child 130 | 9417ae986d2a |
permissions | -rw-r--r-- |
61 | 1 |
import os |
119 | 2 |
|
61 | 3 |
from django.core.files.storage import FileSystemStorage |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
4 |
from django.db import models |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
5 |
from django.contrib.auth.models import User |
119 | 6 |
|
48 | 7 |
import tagging |
8 |
from tagging.fields import TagField |
|
9 |
||
119 | 10 |
from pytask.taskapp.utilities.helper import get_key |
11 |
||
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
12 |
GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female')) |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
13 |
RIGHTS_CHOICES = ( |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
14 |
("AD", "Admin"), |
107 | 15 |
("MG", "Manager"), |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
16 |
("DV", "Developer"), |
10
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
17 |
("CT", "Contributor"),) |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
18 |
|
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
19 |
STATUS_CHOICES = ( |
18
a39549bd5b08
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:
12
diff
changeset
|
20 |
("UP", "Unpublished"), |
51 | 21 |
("OP", "Open"), |
10
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
22 |
("LO", "Locked"), |
63
1fc027bf99ee
added events in task.py for adding subtask and dependencies
nishanth
parents:
61
diff
changeset
|
23 |
("WR", "Working"), |
10
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
24 |
("CD", "Closed"), |
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
25 |
("DL", "Deleted"), |
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
26 |
("CM", "Completed")) |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
27 |
|
128
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
28 |
NOTIFY_CHOICES = ( |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
29 |
("MT", "Add Mentor"), |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
30 |
("DV", "Developer"), |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
31 |
("MG", "Manager"), |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
32 |
("AD", "Admin"), |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
33 |
("PY", "Assign credits"), |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
34 |
("CM", "Task completed"), |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
35 |
("CD", "Task closed"), |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
36 |
("DL", "Task deleted"), |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
37 |
("KD", "Kicked off"), |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
38 |
("MS", "Message"), |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
39 |
) |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
40 |
|
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
41 |
|
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
42 |
IMAGES_DIR = "./images" |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
43 |
UPLOADS_DIR = "./uploads" |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
44 |
|
118 | 45 |
|
61 | 46 |
class CustomImageStorage(FileSystemStorage): |
47 |
||
48 |
def path(self, name): |
|
49 |
""" we return images directory path. |
|
50 |
""" |
|
51 |
||
52 |
return os.path.join(IMAGES_DIR, name) |
|
53 |
||
54 |
def get_available_name(self, name): |
|
55 |
""" here we are going with username as the name of image. |
|
56 |
""" |
|
57 |
||
58 |
root, ext = os.path.splitext(name) |
|
118 | 59 |
file_name = get_key() + ext |
60 |
while self.exists(file_name): |
|
61 |
file_name = get_key() + ext |
|
62 |
return file_name |
|
61 | 63 |
|
10
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
64 |
class Profile(models.Model): |
59 | 65 |
|
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
66 |
user = models.ForeignKey(User, unique = True) |
38
7910ff503036
added help_text and verbose_name to models where required and removed import of seed_db from urls.py
nishanth
parents:
33
diff
changeset
|
67 |
dob = models.DateField(verbose_name = u"Date of Birth", help_text = "YYYY-MM-DD") |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
68 |
gender = models.CharField(max_length = 1, choices = GENDER_CHOICES) |
12
a93eebabfeb1
created forms, views, templates, actions for home_page, browse_task.
nishanth
parents:
10
diff
changeset
|
69 |
rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT") |
a93eebabfeb1
created forms, views, templates, actions for home_page, browse_task.
nishanth
parents:
10
diff
changeset
|
70 |
credits = models.PositiveSmallIntegerField(default = 0) |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
71 |
|
12
a93eebabfeb1
created forms, views, templates, actions for home_page, browse_task.
nishanth
parents:
10
diff
changeset
|
72 |
aboutme = models.TextField(blank = True) |
48 | 73 |
foss_comm = TagField() |
38
7910ff503036
added help_text and verbose_name to models where required and removed import of seed_db from urls.py
nishanth
parents:
33
diff
changeset
|
74 |
phonenum = models.CharField(max_length = 15, blank = True, verbose_name = u"Phone Number") |
7910ff503036
added help_text and verbose_name to models where required and removed import of seed_db from urls.py
nishanth
parents:
33
diff
changeset
|
75 |
homepage = models.URLField(blank = True, verbose_name = u"Homepage/Blog") |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
76 |
street = models.CharField(max_length = 80, blank = True) |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
77 |
city = models.CharField(max_length = 25, blank = True) |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
78 |
country = models.CharField(max_length = 25, blank = True) |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
79 |
nick = models.CharField(max_length = 20, blank = True) |
61 | 80 |
photo = models.ImageField(storage = CustomImageStorage(),upload_to = IMAGES_DIR, blank = True) |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
81 |
|
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
82 |
def __unicode__(self): |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
83 |
return unicode(self.user.username) |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
84 |
|
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
85 |
|
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
86 |
class Task(models.Model): |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
87 |
|
119 | 88 |
prim_key = models.AutoField(primary_key = True) |
89 |
id = models.CharField(max_length = 10, unique = True) |
|
38
7910ff503036
added help_text and verbose_name to models where required and removed import of seed_db from urls.py
nishanth
parents:
33
diff
changeset
|
90 |
title = models.CharField(max_length = 100, unique = True, verbose_name = u"Title", help_text = u"Keep it simple and below 100 chars.") |
7910ff503036
added help_text and verbose_name to models where required and removed import of seed_db from urls.py
nishanth
parents:
33
diff
changeset
|
91 |
desc = models.TextField(verbose_name = u"Description") |
18
a39549bd5b08
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:
12
diff
changeset
|
92 |
status = models.CharField(max_length = 2, choices = STATUS_CHOICES, default = "UP") |
49 | 93 |
tags_field = TagField() |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
94 |
|
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
95 |
credits = models.PositiveSmallIntegerField() |
18
a39549bd5b08
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:
12
diff
changeset
|
96 |
progress = models.PositiveSmallIntegerField(default = 0) |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
97 |
|
10
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
98 |
mentors = models.ManyToManyField(User, related_name = "%(class)s_mentors") |
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
99 |
created_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
100 |
claimed_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_claimed_users") |
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
101 |
assigned_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_assigned_users") |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
102 |
|
10
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
103 |
creation_datetime = models.DateTimeField() |
124
6d92b7cd2a37
taking care if publish task post request is made again. added published_date field to task.
nishanth
parents:
123
diff
changeset
|
104 |
published_datetime = models.DateTimeField() |
90
b2426897ff18
our task model does not meet out needs. so modified it and added a model called map. made the changes in views accordingly.phew!!!. this one took the hell out of me :( .
nishanth
parents:
86
diff
changeset
|
105 |
sub_type = models.CharField(max_length=1, choices = (('D','Dependency'),('S','Subtask')), default = 'D') |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
106 |
|
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
107 |
def __unicode__(self): |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
108 |
return unicode(self.title) |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
109 |
|
90
b2426897ff18
our task model does not meet out needs. so modified it and added a model called map. made the changes in views accordingly.phew!!!. this one took the hell out of me :( .
nishanth
parents:
86
diff
changeset
|
110 |
class Map(models.Model): |
b2426897ff18
our task model does not meet out needs. so modified it and added a model called map. made the changes in views accordingly.phew!!!. this one took the hell out of me :( .
nishanth
parents:
86
diff
changeset
|
111 |
|
b2426897ff18
our task model does not meet out needs. so modified it and added a model called map. made the changes in views accordingly.phew!!!. this one took the hell out of me :( .
nishanth
parents:
86
diff
changeset
|
112 |
main = models.ForeignKey('Task', related_name = "%(class)s_main") |
b2426897ff18
our task model does not meet out needs. so modified it and added a model called map. made the changes in views accordingly.phew!!!. this one took the hell out of me :( .
nishanth
parents:
86
diff
changeset
|
113 |
subs = models.ManyToManyField('Task', blank = True, null = True, related_name = "%(class)s_subs") |
b2426897ff18
our task model does not meet out needs. so modified it and added a model called map. made the changes in views accordingly.phew!!!. this one took the hell out of me :( .
nishanth
parents:
86
diff
changeset
|
114 |
|
b2426897ff18
our task model does not meet out needs. so modified it and added a model called map. made the changes in views accordingly.phew!!!. this one took the hell out of me :( .
nishanth
parents:
86
diff
changeset
|
115 |
|
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
116 |
class Comment(models.Model): |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
117 |
|
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
118 |
task = models.ForeignKey('Task') |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
119 |
data = models.TextField() |
10
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
120 |
created_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
121 |
creation_datetime = models.DateTimeField() |
59 | 122 |
deleted_by = models.ForeignKey(User, null = True, blank = True, related_name = "%(class)s_deleted_by") |
112
eadff01e395e
now task page displays only undeleted comments. and publish task removes previous comments.
nishanth
parents:
107
diff
changeset
|
123 |
is_deleted = models.BooleanField() |
59 | 124 |
attachment = models.FileField(upload_to = UPLOADS_DIR, blank = True) |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
125 |
|
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
126 |
def __unicode__(self): |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
127 |
return unicode(self.task.title) |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
128 |
|
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
129 |
class Credit(models.Model): |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
130 |
|
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
131 |
task = models.ForeignKey('Task') |
10
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
132 |
given_by = models.ForeignKey(User, related_name = "%(class)s_given_by") |
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
133 |
given_to = models.ForeignKey(User, related_name = "%(class)s_given_to") |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
134 |
points = models.PositiveSmallIntegerField() |
10
bf0cbea1bd12
removed views.py and made it a package. added auth_profile to settings.py
nishanth
parents:
1
diff
changeset
|
135 |
given_time = models.DateTimeField() |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
136 |
|
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
137 |
def __unicode__(self): |
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
138 |
return unicode(self.task.title) |
21
c28774fe7ffd
implemented "add another mentor" functionality to a task.
nishanth
parents:
18
diff
changeset
|
139 |
|
c28774fe7ffd
implemented "add another mentor" functionality to a task.
nishanth
parents:
18
diff
changeset
|
140 |
class Claim(models.Model): |
1
7818992cbf83
Created taskapp and added data to models.py and edited settings.py to make it usable in admin interface.
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
141 |
|
21
c28774fe7ffd
implemented "add another mentor" functionality to a task.
nishanth
parents:
18
diff
changeset
|
142 |
task = models.ForeignKey('Task') |
c28774fe7ffd
implemented "add another mentor" functionality to a task.
nishanth
parents:
18
diff
changeset
|
143 |
user = models.ForeignKey(User) |
c28774fe7ffd
implemented "add another mentor" functionality to a task.
nishanth
parents:
18
diff
changeset
|
144 |
message = models.TextField() |
c28774fe7ffd
implemented "add another mentor" functionality to a task.
nishanth
parents:
18
diff
changeset
|
145 |
creation_datetime = models.DateTimeField() |
51 | 146 |
|
147 |
class Request(models.Model): |
|
148 |
||
85 | 149 |
sent_to = models.ManyToManyField(User, related_name = "%(class)s_sent_to", blank = False) |
150 |
sent_by = models.ForeignKey(User, related_name = "%(class)s_sent_by", blank = False) |
|
51 | 151 |
role = models.CharField(max_length = 2, blank = False) |
116 | 152 |
reply = models.BooleanField(default = False, blank = False) |
104 | 153 |
remarks = models.TextField(default = "",blank = True) |
119 | 154 |
|
116 | 155 |
is_read = models.BooleanField(default = False, blank = False) |
156 |
is_valid = models.BooleanField(default = True, blank = False) |
|
119 | 157 |
|
51 | 158 |
creation_date = models.DateTimeField() |
159 |
reply_date = models.DateTimeField() |
|
85 | 160 |
is_replied = models.BooleanField(default = False) |
86 | 161 |
replied_by = models.ForeignKey(User, related_name = "%(class)s_replied_by", blank = True, null = True) |
119 | 162 |
|
59 | 163 |
task = models.ForeignKey(Task,related_name = "%(class)s_task", blank = True, null = True) |
85 | 164 |
receiving_user = models.ForeignKey(User, related_name = "%(class)s_receiving_user", blank = True, null = True) |
80 | 165 |
pynts = models.PositiveIntegerField(default=0) |
51 | 166 |
|
83 | 167 |
def __unicode__(self): |
168 |
||
86 | 169 |
return u"Request %s %s"%(self.sent_by.username, self.role) |
83 | 170 |
|
51 | 171 |
class Notification(models.Model): |
172 |
||
128
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
173 |
role = models.CharField(max_length = 2, choices = NOTIFY_CHOICES, blank = False) |
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
174 |
sent_to = models.ForeignKey(User, related_name = "%(class)s_sent_to", blank = False) |
129
e747da8bc110
notifications work for approving and rejecting credits.
nishanth
parents:
128
diff
changeset
|
175 |
sent_from = models.ForeignKey(User, related_name = "%(class)s_sent_from", null = True, blank = True) |
e747da8bc110
notifications work for approving and rejecting credits.
nishanth
parents:
128
diff
changeset
|
176 |
task = models.ForeignKey(Task, related_name = "%(class)s_sent_for", null = True, blank = True) |
128
f34e3a3e1439
modified the notifications model. the sent_to is now a foreign key. now if we have a new type to be added, we can generate message and sub while creating notification. we can keep track of history using the role field in notification and task/sent_from
nishanth
parents:
124
diff
changeset
|
177 |
|
123 | 178 |
|
51 | 179 |
sub = models.CharField(max_length = 100) |
180 |
message = models.TextField() |
|
129
e747da8bc110
notifications work for approving and rejecting credits.
nishanth
parents:
128
diff
changeset
|
181 |
remarks = models.CharField(max_length = 100) |
123 | 182 |
|
183 |
sent_date = models.DateTimeField() |
|
184 |
is_read = models.BooleanField(default = False) |
|
185 |
is_deleted = models.BooleanField(default = False) |
|
21
c28774fe7ffd
implemented "add another mentor" functionality to a task.
nishanth
parents:
18
diff
changeset
|
186 |
|
48 | 187 |
tagging.register(Profile) |
188 |
tagging.register(Task) |