pytask/taskapp/models.py
changeset 92 b92347d24557
parent 90 437af7ad6cb9
child 93 54152e4f5cd7
--- a/pytask/taskapp/models.py	Sat Jan 08 21:39:01 2011 +0530
+++ b/pytask/taskapp/models.py	Sat Jan 08 21:57:19 2011 +0530
@@ -4,7 +4,7 @@
 import tagging
 from tagging.fields import TagField
 
-STATUS_CHOICES = (
+TASK_STATUS_CHOICES = (
         ("UP", "Unpublished"),
         ("OP", "Open"),
         ("LO", "Locked"),
@@ -13,6 +13,12 @@
         ("DL", "Deleted"),
         ("CM", "Completed"))
 
+TB_STATUS_CHOICES = (
+    ("UP", "Unpublished"),
+    ("OP", "Open"),
+    ("WR", "All tasks have users selected"),
+    ("CM", "Completed"))
+
 UPLOADS_DIR = "./pytask/static/uploads"
 
 class Task(models.Model):
@@ -22,7 +28,7 @@
                              help_text = u"Keep it simple and below 100 chars.")
     desc = models.TextField(verbose_name = u"Description")
 
-    status = models.CharField(max_length = 2, choices = STATUS_CHOICES, default = "UP")
+    status = models.CharField(max_length = 2, choices = TASK_STATUS_CHOICES, default = "UP")
     tags_field = TagField(verbose_name = u"Tags", 
                           help_text = u"Give tags seperated by commas") 
     
@@ -38,6 +44,7 @@
                                             related_name = "%(class)s_selected_users")
     
     creation_datetime = models.DateTimeField()
+    approval_datetime = models.DateTimeField()
     
     def __unicode__(self):
         return unicode(self.title)
@@ -121,4 +128,16 @@
     request_datetime = models.DateTimeField()
     is_responded = models.BooleanField(default=False)
 
+class TextBook(models.Model):
+
+    uniq_key = models.CharField(max_length = 10, unique = True)
+    tags_field = TagField(verbose_name="Tags")
+
+    created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
+    approved_by = models.ForeignKey(User, related_name = "%(class)s_approved_by")
+
+    status = models.CharField(max_length = 2, choices = TB_STATUS_CHOICES, default = "UP")
+    creation_datetime = models.DateTimeField()
+    approval_datetime = models.DateTimeField()
+
 tagging.register(Task)