taskapp/models.py
changeset 48 8670846be981
parent 38 7910ff503036
child 49 52b774df918e
equal deleted inserted replaced
47:4e059a4220cc 48:8670846be981
     1 from django.db import models
     1 from django.db import models
     2 from django.contrib.auth.models import User
     2 from django.contrib.auth.models import User
       
     3 import tagging
       
     4 from tagging.fields import TagField
       
     5 
     3 
     6 
     4 GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female'))
     7 GENDER_CHOICES = (( 'M', 'Male'), ('F', 'Female'))
     5 RIGHTS_CHOICES = (
     8 RIGHTS_CHOICES = (
     6 	("AD", "Admin"),
     9 	("AD", "Admin"),
     7 	("MN", "Manager"),
    10 	("MN", "Manager"),
    29     gender = models.CharField(max_length = 1, choices = GENDER_CHOICES)
    32     gender = models.CharField(max_length = 1, choices = GENDER_CHOICES)
    30     rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT")
    33     rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT")
    31     credits = models.PositiveSmallIntegerField(default = 0)
    34     credits = models.PositiveSmallIntegerField(default = 0)
    32     
    35     
    33     aboutme = models.TextField(blank = True)
    36     aboutme = models.TextField(blank = True)
    34     foss_comm = models.CharField(max_length = 80, blank = True, verbose_name = u"Foss Communities", help_text = u"Comma seperated list of foss communities you are involved in.")
    37 #    foss_comm = models.CharField(max_length = 80, blank = True, verbose_name = u"Foss Communities", help_text = u"Comma seperated list of foss communities you are involved in.")
       
    38     foss_comm = TagField()
    35     phonenum = models.CharField(max_length = 15, blank = True, verbose_name = u"Phone Number")
    39     phonenum = models.CharField(max_length = 15, blank = True, verbose_name = u"Phone Number")
    36     homepage = models.URLField(blank = True, verbose_name = u"Homepage/Blog")
    40     homepage = models.URLField(blank = True, verbose_name = u"Homepage/Blog")
    37     street = models.CharField(max_length = 80, blank = True)
    41     street = models.CharField(max_length = 80, blank = True)
    38     city = models.CharField(max_length = 25, blank = True)
    42     city = models.CharField(max_length = 25, blank = True)
    39     country = models.CharField(max_length = 25, blank = True)
    43     country = models.CharField(max_length = 25, blank = True)
    47 class Task(models.Model):
    51 class Task(models.Model):
    48     
    52     
    49     title = models.CharField(max_length = 100, unique = True, verbose_name = u"Title", help_text = u"Keep it simple and below 100 chars.")
    53     title = models.CharField(max_length = 100, unique = True, verbose_name = u"Title", help_text = u"Keep it simple and below 100 chars.")
    50     desc = models.TextField(verbose_name = u"Description")
    54     desc = models.TextField(verbose_name = u"Description")
    51     status = models.CharField(max_length = 2, choices = STATUS_CHOICES, default = "UP")
    55     status = models.CharField(max_length = 2, choices = STATUS_CHOICES, default = "UP")
    52     tags = models.CharField(max_length = 200, blank = True)
    56 #    tags = models.CharField(max_length = 200, blank = True)
       
    57     tags = TagField()
    53     
    58     
    54     subs = models.ManyToManyField('self', blank = True, related_name = "%(class)s_parents")
    59     subs = models.ManyToManyField('self', blank = True, related_name = "%(class)s_parents")
    55     deps = models.ManyToManyField('self', blank = True, related_name = "%(class)s_deps")
    60     deps = models.ManyToManyField('self', blank = True, related_name = "%(class)s_deps")
    56     
    61     
    57     credits = models.PositiveSmallIntegerField()
    62     credits = models.PositiveSmallIntegerField()
   102     task = models.ForeignKey('Task')
   107     task = models.ForeignKey('Task')
   103     user = models.ForeignKey(User)
   108     user = models.ForeignKey(User)
   104     message = models.TextField()
   109     message = models.TextField()
   105     creation_datetime = models.DateTimeField()
   110     creation_datetime = models.DateTimeField()
   106     
   111     
       
   112 tagging.register(Profile)
       
   113 tagging.register(Task)