little things
[zzz-floof.git] / floof / model / art.py
index 9ff00c5..544a830 100644 (file)
@@ -16,9 +16,9 @@ from floof.lib.dbhelpers import find_or_create, update_or_create
 class Art(Entity):
     title = Field(Unicode(120))
     original_filename = Field(Unicode(120))
-    hash = Field(String)
+    hash = Field(String, unique=True, required=True)
 
-    uploader = ManyToOne('User')
+    uploader = ManyToOne('User', required=True)
     tags = OneToMany('Tag')
 
     # def __init__(self, **kwargs):
@@ -33,6 +33,7 @@ class Art(Entity):
 
     def set_file(self, file):
         self.hash = save_file("art", file)
+        self.original_filename = file.filename
 
     file = property(get_path, set_file)
 
@@ -118,4 +119,16 @@ class Rating(Entity):
     # options = ["sucks","neutral","good","great"]
     
 
-Rating.reverse_options = dict (zip(Rating.options.values(), Rating.options.keys()))
\ No newline at end of file
+Rating.reverse_options = dict (zip(Rating.options.values(), Rating.options.keys()))
+
+
+
+
+class UserRelation(Entity):
+    related = ManyToOne("User")
+    art = ManyToOne("Art")
+    type = Field(String) # by for of
+    
+    
+# class CharacterRelation(Entity):
+#     pass
\ No newline at end of file