author | Madhusudan.C.S <madhusudancs@gmail.com> |
Fri, 14 Jan 2011 01:00:22 +0530 | |
branch | buildout |
changeset 237 | 2c72b08003f5 |
parent 227 | 3c8f3b0e5b00 |
permissions | -rw-r--r-- |
227
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1 |
import os |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
from django.core.files.storage import FileSystemStorage |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4 |
from django.db import models |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5 |
from django.contrib.auth.models import User |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
7 |
import tagging |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
8 |
from tagging.fields import TagField |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
10 |
from pytask.taskapp.utilities.helper import get_key |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
11 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
12 |
GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female')) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
13 |
RIGHTS_CHOICES = ( |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
14 |
("AD", "Admin"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
15 |
("MG", "Manager"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
16 |
("DV", "Developer"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
17 |
("CT", "Contributor"),) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
18 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
19 |
STATUS_CHOICES = ( |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
20 |
("UP", "Unpublished"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
21 |
("OP", "Open"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
22 |
("LO", "Locked"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
23 |
("WR", "Working"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
24 |
("CD", "Closed"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
25 |
("DL", "Deleted"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
26 |
("CM", "Completed")) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
27 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
28 |
NOTIFY_CHOICES = ( |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
29 |
("MT", "Add Mentor"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
30 |
("DV", "Developer"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
31 |
("MG", "Manager"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
32 |
("AD", "Admin"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
33 |
("PY", "Assign credits"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
34 |
("CM", "Task completed"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
35 |
("CD", "Task closed"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
36 |
("DL", "Task deleted"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
37 |
("NU", "New User"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
38 |
("NT", "New Mentor"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
39 |
("ND", "New Developer"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
40 |
("NG", "New Manager"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
41 |
("NA", "New Admin"), |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
42 |
("AU", "Assign user"), ## i mean assign the task |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
43 |
("RU", "Remove user"), ## remove from working users list in task |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
44 |
) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
45 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
46 |
IMAGES_DIR = "./images" |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
47 |
UPLOADS_DIR = "./uploads" |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
48 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
49 |
class CustomImageStorage(FileSystemStorage): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
50 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
51 |
def path(self, name): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
52 |
""" we return images directory path. |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
53 |
""" |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
54 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
55 |
return os.path.join(IMAGES_DIR, name) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
56 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
57 |
def get_available_name(self, name): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
58 |
""" here we are going with username as the name of image. |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
59 |
""" |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
60 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
61 |
root, ext = os.path.splitext(name) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
62 |
file_name = get_key() + ext |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
63 |
while self.exists(file_name): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
64 |
file_name = get_key() + ext |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
65 |
return file_name |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
66 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
67 |
class Profile(models.Model): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
68 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
69 |
user = models.ForeignKey(User, unique = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
70 |
dob = models.DateField(verbose_name = u"Date of Birth", help_text = "YYYY-MM-DD") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
71 |
gender = models.CharField(max_length = 1, choices = GENDER_CHOICES) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
72 |
rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
73 |
credits = models.PositiveSmallIntegerField(default = 0) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
74 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
75 |
aboutme = models.TextField(blank = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
76 |
foss_comm = TagField(verbose_name="FOSS Communities") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
77 |
phonenum = models.CharField(max_length = 15, blank = True, verbose_name = u"Phone Number") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
78 |
homepage = models.URLField(blank = True, verbose_name = u"Homepage/Blog") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
79 |
street = models.CharField(max_length = 80, blank = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
80 |
city = models.CharField(max_length = 25, blank = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
81 |
country = models.CharField(max_length = 25, blank = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
82 |
nick = models.CharField(max_length = 20, blank = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
83 |
photo = models.ImageField(storage = CustomImageStorage(),upload_to = IMAGES_DIR, blank = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
84 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
85 |
def __unicode__(self): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
86 |
return unicode(self.user.username) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
87 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
88 |
class Task(models.Model): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
89 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
90 |
prim_key = models.AutoField(primary_key = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
91 |
id = models.CharField(max_length = 10, unique = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
92 |
title = models.CharField(max_length = 100, verbose_name = u"Title", help_text = u"Keep it simple and below 100 chars.") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
93 |
desc = models.TextField(verbose_name = u"Description") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
94 |
status = models.CharField(max_length = 2, choices = STATUS_CHOICES, default = "UP") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
95 |
tags_field = TagField(verbose_name = u"Tags", help_text = u"Give comma seperated tags") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
96 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
97 |
credits = models.PositiveSmallIntegerField(help_text = u"No.of credits a user gets on completing the task") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
98 |
progress = models.PositiveSmallIntegerField(default = 0) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
99 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
100 |
mentors = models.ManyToManyField(User, related_name = "%(class)s_mentors") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
101 |
created_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
102 |
claimed_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_claimed_users") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
103 |
assigned_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_assigned_users") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
104 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
105 |
creation_datetime = models.DateTimeField() |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
106 |
published_datetime = models.DateTimeField() |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
107 |
sub_type = models.CharField(max_length=1, choices = (('D','Dependency'),('S','Subtask')), default = 'D') |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
108 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
109 |
def __unicode__(self): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
110 |
return unicode(self.title) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
111 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
112 |
class Map(models.Model): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
113 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
114 |
main = models.ForeignKey('Task', related_name = "%(class)s_main") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
115 |
subs = models.ManyToManyField('Task', blank = True, null = True, related_name = "%(class)s_subs") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
116 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
117 |
class Comment(models.Model): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
118 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
119 |
task = models.ForeignKey('Task') |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
120 |
data = models.TextField() |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
121 |
created_by = models.ForeignKey(User, related_name = "%(class)s_created_by") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
122 |
creation_datetime = models.DateTimeField() |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
123 |
deleted_by = models.ForeignKey(User, null = True, blank = True, related_name = "%(class)s_deleted_by") |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
124 |
is_deleted = models.BooleanField() |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
125 |
attachment = models.FileField(upload_to = UPLOADS_DIR, blank = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
126 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
127 |
def __unicode__(self): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
128 |
return unicode(self.task.title) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
129 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
130 |
class Request(models.Model): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
131 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
132 |
sent_to = models.ManyToManyField(User, related_name = "%(class)s_sent_to", blank = False) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
133 |
sent_by = models.ForeignKey(User, related_name = "%(class)s_sent_by", blank = False) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
134 |
role = models.CharField(max_length = 2, blank = False) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
135 |
reply = models.BooleanField(default = False, blank = False) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
136 |
remarks = models.TextField(default = "",blank = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
137 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
138 |
is_read = models.BooleanField(default = False, blank = False) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
139 |
is_valid = models.BooleanField(default = True, blank = False) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
140 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
141 |
creation_date = models.DateTimeField() |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
142 |
reply_date = models.DateTimeField() |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
143 |
is_replied = models.BooleanField(default = False) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
144 |
replied_by = models.ForeignKey(User, related_name = "%(class)s_replied_by", blank = True, null = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
145 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
146 |
task = models.ForeignKey(Task,related_name = "%(class)s_task", blank = True, null = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
147 |
receiving_user = models.ForeignKey(User, related_name = "%(class)s_receiving_user", blank = True, null = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
148 |
pynts = models.PositiveIntegerField(default=0) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
149 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
150 |
def __unicode__(self): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
151 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
152 |
return u"Request %s %s"%(self.sent_by.username, self.role) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
153 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
154 |
class Notification(models.Model): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
155 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
156 |
role = models.CharField(max_length = 2, choices = NOTIFY_CHOICES, blank = False) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
157 |
sent_to = models.ForeignKey(User, related_name = "%(class)s_sent_to", blank = False) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
158 |
sent_from = models.ForeignKey(User, related_name = "%(class)s_sent_from", null = True, blank = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
159 |
task = models.ForeignKey(Task, related_name = "%(class)s_task", null = True, blank = True) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
160 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
161 |
sub = models.CharField(max_length = 100) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
162 |
message = models.TextField() |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
163 |
remarks = models.CharField(max_length = 100) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
164 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
165 |
sent_date = models.DateTimeField() |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
166 |
is_read = models.BooleanField(default = False) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
167 |
is_deleted = models.BooleanField(default = False) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
168 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
169 |
def __unicode__(self): |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
170 |
return u"%s %s %s"%(self.sent_to, self.message, self.sent_date.ctime()) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
171 |
|
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
172 |
tagging.register(Profile) |
3c8f3b0e5b00
Add support for buildout and move the files to the directory to support buildout structure.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
173 |
tagging.register(Task) |