blob: 7c957a196a4b8663c3dd10206f2df5f1c5888670 [file] [log] [blame]
Siobhan Tullyde5450d2013-06-21 11:35:33 -04001import os
2from django.db import models
3from core.models import PlCoreBase
Siobhan Tullyd3515752013-06-21 16:34:53 -04004from core.models import Project
Siobhan Tullyde5450d2013-06-21 11:35:33 -04005from django.contrib.contenttypes.models import ContentType
6from django.contrib.contenttypes import generic
7
8# Create your models here.
9
10class Tag(PlCoreBase):
11
Siobhan Tullyd3515752013-06-21 16:34:53 -040012 project = models.ForeignKey(Project, related_name='tags', help_text="The Project this Tag is associated with")
13
Siobhan Tullyde5450d2013-06-21 11:35:33 -040014 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