Fixed adding regular tags.
[zzz-floof.git] / floof / model / tags.py
1 from elixir import *
2 from art import Art
3
4 class Tag(Entity):
5 # look into how ondelete works. This just sets a database property.
6 art = ManyToOne('Art', ondelete='cascade', required=True)
7 tagger = ManyToOne('User', ondelete='cascade', required=True)
8 tagtext = ManyToOne('TagText', required=True)
9
10 def __unicode__(self):
11 if not self.tagtext:
12 return "(broken)"
13 return unicode(self.tagtext)
14
15 class TagText(Entity):
16 text = Field(Unicode(50), required=True) # gotta enforce this somehow
17 tags = OneToMany('Tag')
18
19 def __unicode__(self):
20 return self.text