+ hash = Field(Unicode(40), unique=True, required=True)
+ mimetype = Field(Unicode(32), required=True)
+
+ uploader = ManyToOne('User', required=True)
+ tags = OneToMany('Tag')
+ discussion = ManyToOne('Discussion')
+
+ art_users = OneToMany('ArtUser')
+
+ @property
+ def file_path(self):
+ return get_path("art", self.hash)
+
+ # Associated users
+ # XXX ok these could stand to do the filtering sql-side
+ @property
+ def artists(self):
+ return (au.user for au in self.art_users if au.type == ArtUserType.BY)