+ original_filename = Field(Unicode(120))
+ hash = Field(String, unique=True, required=True)
+
+ uploader = ManyToOne('User', required=True)
+ tags = OneToMany('Tag')
+ discussion = ManyToOne('Discussion')
+
+ user_relations = OneToMany('UserRelation')
+
+
+ def set_file(self, file):
+ self.hash = save_file("art", file)
+ self.original_filename = file.filename
+
+ file = property(get_path, set_file)
+
+ def get_path(self):
+ if self.hash:
+ return get_path("art", self.hash)