b0a7072a211623ffa61ca59e38e6d40f53a84cfc
[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')
7 tagger = ManyToOne('User', ondelete='cascade')
8 tagtext = ManyToOne('TagText')
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)) # gotta enforce this somehow
17 tags = OneToMany('Tag')
18
19 def __unicode__(self):
20 return self.text