taskapp/models.py
changeset 59 f6a3bf088a9e
parent 58 e0ec1901dfce
child 61 708dd49d531b
equal deleted inserted replaced
58:e0ec1901dfce 59:f6a3bf088a9e
    23 
    23 
    24 IMAGES_DIR = "./images"
    24 IMAGES_DIR = "./images"
    25 UPLOADS_DIR = "./uploads"
    25 UPLOADS_DIR = "./uploads"
    26 
    26 
    27 class Profile(models.Model):
    27 class Profile(models.Model):
    28 	
    28     
    29     user = models.ForeignKey(User, unique = True)
    29     user = models.ForeignKey(User, unique = True)
    30     dob = models.DateField(verbose_name = u"Date of Birth", help_text = "YYYY-MM-DD")
    30     dob = models.DateField(verbose_name = u"Date of Birth", help_text = "YYYY-MM-DD")
    31     gender = models.CharField(max_length = 1, choices = GENDER_CHOICES)
    31     gender = models.CharField(max_length = 1, choices = GENDER_CHOICES)
    32     rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT")
    32     rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT")
    33     credits = models.PositiveSmallIntegerField(default = 0)
    33     credits = models.PositiveSmallIntegerField(default = 0)
    39     homepage = models.URLField(blank = True, verbose_name = u"Homepage/Blog")
    39     homepage = models.URLField(blank = True, verbose_name = u"Homepage/Blog")
    40     street = models.CharField(max_length = 80, blank = True)
    40     street = models.CharField(max_length = 80, blank = True)
    41     city = models.CharField(max_length = 25, blank = True)
    41     city = models.CharField(max_length = 25, blank = True)
    42     country = models.CharField(max_length = 25, blank = True)
    42     country = models.CharField(max_length = 25, blank = True)
    43     nick = models.CharField(max_length = 20, blank = True)
    43     nick = models.CharField(max_length = 20, blank = True)
    44 #    photo = models.ImageField(upload_to = IMAGES_DIR, blank = True)
    44     photo = models.ImageField(upload_to = IMAGES_DIR, blank = True)
    45 
    45 
    46     def __unicode__(self):
    46     def __unicode__(self):
    47         return unicode(self.user.username)
    47         return unicode(self.user.username)
    48 
    48 
    49 
    49 
    81     
    81     
    82     task = models.ForeignKey('Task')
    82     task = models.ForeignKey('Task')
    83     data = models.TextField()
    83     data = models.TextField()
    84     created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
    84     created_by = models.ForeignKey(User, related_name = "%(class)s_created_by")
    85     creation_datetime = models.DateTimeField()
    85     creation_datetime = models.DateTimeField()
    86 #    deleted_by = models.ForeignKey(User, null = True, blank = True, related_name = "%(class)s_deleted_by")
    86     deleted_by = models.ForeignKey(User, null = True, blank = True, related_name = "%(class)s_deleted_by")
    87 #    deleted = models.BooleanField()
    87     deleted = models.BooleanField()
    88 #    attachment = models.FileField(upload_to = UPLOADS_DIR, blank = True)
    88     attachment = models.FileField(upload_to = UPLOADS_DIR, blank = True)
    89     
    89     
    90     def __unicode__(self):
    90     def __unicode__(self):
    91         return unicode(self.task.title)
    91         return unicode(self.task.title)
    92 
    92 
    93 class Credit(models.Model):
    93 class Credit(models.Model):
   117     reply = models.BooleanField(default = False)
   117     reply = models.BooleanField(default = False)
   118     read = models.BooleanField(default = False)
   118     read = models.BooleanField(default = False)
   119     creation_date = models.DateTimeField()
   119     creation_date = models.DateTimeField()
   120     reply_date = models.DateTimeField()
   120     reply_date = models.DateTimeField()
   121     replied = models.BooleanField(default = False)
   121     replied = models.BooleanField(default = False)
       
   122     task = models.ForeignKey(Task,related_name = "%(class)s_task", blank = True, null = True)
   122 
   123 
   123 class Notification(models.Model):
   124 class Notification(models.Model):
   124 
   125 
   125     to = models.ManyToManyField(User, related_name = "%(class)s_to", blank = False)
   126     to = models.ManyToManyField(User, related_name = "%(class)s_to", blank = False)
   126     is_read = models.BooleanField(default = False)
   127     is_read = models.BooleanField(default = False)