taskapp/models.py
changeset 9 3ad980fc23ca
parent 1 7818992cbf83
child 12 a93eebabfeb1
--- a/taskapp/models.py	Sun Jan 24 19:15:28 2010 +0530
+++ b/taskapp/models.py	Thu Feb 04 19:34:03 2010 +0530
@@ -6,37 +6,38 @@
 	("AD", "Admin"),
 	("MN", "Manager"),
 	("DV", "Developer"),
-	("MT", "Mentor"),
-	("CT", "Contributor"),
-	("GP", "Public"),)
+	("CT", "Contributor"),)
 
 STATUS_CHOICES = (
 	("OP", "Open"),
+    ("LO", "Locked"),
 	("CL", "Claimed"),
-	("LO", "Locked"),
-	("AS", "Assigned"),)
+	("AS", "Assigned"),
+    ("RO", "Reopened"),
+    ("CD", "Closed"),
+    ("DL", "Deleted"),
+    ("CM", "Completed"))
 
 IMAGES_DIR = "./images"
 UPLOADS_DIR = "./uploads"
 
-class Person(models.Model):
-#class Person(User):
+class Profile(models.Model):
 	
     user = models.ForeignKey(User, unique = True)
     aboutme = models.TextField()
-    DOB = models.DateField()
+    dob = models.DateField()
     gender = models.CharField(max_length = 1, choices = GENDER_CHOICES)
     rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES)
     credits = models.PositiveSmallIntegerField()
     
     foss_comm = models.CharField(max_length = 80, blank = True)
-    phoneNum = models.CharField(max_length = 15, blank = True)
+    phonenum = models.CharField(max_length = 15, blank = True)
     homepage = models.URLField(blank = True)
     street = models.CharField(max_length = 80, blank = True)
     city = models.CharField(max_length = 25, blank = True)
     country = models.CharField(max_length = 25, blank = True)
     nick = models.CharField(max_length = 20, blank = True)
-    photo = models.ImageField(upload_to = IMAGES_DIR, blank = True)
+#    photo = models.ImageField(upload_to = IMAGES_DIR, blank = True)
 
     def __unicode__(self):
         return unicode(self.user.username)
@@ -49,18 +50,18 @@
     status = models.CharField(max_length = 2, choices = STATUS_CHOICES)
     tags = models.CharField(max_length = 200, blank = True)
     
-    parents = models.ManyToManyField('self', blank = True, related_name = "%(class)s_parents")
+    subs = models.ManyToManyField('self', blank = True, related_name = "%(class)s_parents")
     deps = models.ManyToManyField('self', blank = True, related_name = "%(class)s_deps")
     
     credits = models.PositiveSmallIntegerField()
     progress = models.PositiveSmallIntegerField()
         
-    mentors = models.ManyToManyField('Person', related_name = "%(class)s_mentors")
-    created_by = models.ForeignKey('Person', related_name = "%(class)s_created_by")
-    claimed_users = models.ManyToManyField('Person', blank = True, related_name = "%(class)s_claimed_users")
-    assigned_users = models.ManyToManyField('Person', blank = True, related_name = "%(class)s_assigned_users")
+    mentors = models.ManyToManyField(User, related_name = "%(class)s_mentors")
+    created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
+    claimed_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_claimed_users")
+    assigned_users = models.ManyToManyField(User, blank = True, related_name = "%(class)s_assigned_users")
     
-    creation_date = models.DateField()
+    creation_datetime = models.DateTimeField()
     
     ## not yet decided if attribs after this are to be included
     ## tasktype = "" ## "bugfix"/"enhancement"
@@ -73,11 +74,11 @@
     
     task = models.ForeignKey('Task')
     data = models.TextField()
-    created_by = models.ForeignKey('Person', related_name = "%(class)s_created_by")
-    deleted_by = models.ForeignKey('Person', null = True, blank = True, related_name = "%(class)s_deleted_by")
-    creation_date = models.DateField()
-    deleted = models.BooleanField()
-    attachment = models.FileField(upload_to = UPLOADS_DIR, blank = True)
+    created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
+    creation_datetime = models.DateTimeField()
+#    deleted_by = models.ForeignKey(User, null = True, blank = True, related_name = "%(class)s_deleted_by")
+#    deleted = models.BooleanField()
+#    attachment = models.FileField(upload_to = UPLOADS_DIR, blank = True)
     
     def __unicode__(self):
         return unicode(self.task.title)
@@ -85,9 +86,10 @@
 class Credit(models.Model):
     
     task = models.ForeignKey('Task')
-    given_by = models.ForeignKey('Person', related_name = "%(class)s_given_by")
-    given_to = models.ForeignKey('Person', related_name = "%(class)s_given_to")
+    given_by = models.ForeignKey(User, related_name = "%(class)s_given_by")
+    given_to = models.ForeignKey(User, related_name = "%(class)s_given_to")
     points = models.PositiveSmallIntegerField()
+    given_time = models.DateTimeField()
     
     def __unicode__(self):
         return unicode(self.task.title)