Siobhan Tully | de5450d | 2013-06-21 11:35:33 -0400 | [diff] [blame] | 1 | import os |
| 2 | from django.db import models |
| 3 | from core.models import PlCoreBase |
Siobhan Tully | d351575 | 2013-06-21 16:34:53 -0400 | [diff] [blame^] | 4 | from core.models import Project |
Siobhan Tully | de5450d | 2013-06-21 11:35:33 -0400 | [diff] [blame] | 5 | from django.contrib.contenttypes.models import ContentType |
| 6 | from django.contrib.contenttypes import generic |
| 7 | |
| 8 | # Create your models here. |
| 9 | |
| 10 | class Tag(PlCoreBase): |
| 11 | |
Siobhan Tully | d351575 | 2013-06-21 16:34:53 -0400 | [diff] [blame^] | 12 | project = models.ForeignKey(Project, related_name='tags', help_text="The Project this Tag is associated with") |
| 13 | |
Siobhan Tully | de5450d | 2013-06-21 11:35:33 -0400 | [diff] [blame] | 14 | name = models.SlugField(help_text="The name of this tag", max_length=128) |
| 15 | value = models.CharField(help_text="The value of this tag", max_length=1024) |
| 16 | |
| 17 | # The required fields to do a ObjectType lookup, and object_id assignment |
| 18 | content_type = models.ForeignKey(ContentType) |
| 19 | object_id = models.PositiveIntegerField() |
| 20 | content_object = generic.GenericForeignKey('content_type', 'object_id') |
| 21 | |
| 22 | def __unicode__(self): |
| 23 | return self.name |
| 24 | |