Comment posting support.
[zzz-floof.git] / floof / controllers / art.py
index 5186daa..9576109 100644 (file)
@@ -9,6 +9,7 @@ log = logging.getLogger(__name__)
 
 import elixir
 from floof.model.art import Art, Rating
 
 import elixir
 from floof.model.art import Art, Rating
+from floof.model.comments import Discussion
 
 from sqlalchemy.exceptions import IntegrityError
 
 
 from sqlalchemy.exceptions import IntegrityError
 
@@ -31,6 +32,7 @@ class ArtController(BaseController):
     # TODO: login required
     def create(self):
         c.art = Art(uploader=c.user, **request.params)
     # TODO: login required
     def create(self):
         c.art = Art(uploader=c.user, **request.params)
+        c.art.discussion = Discussion(count=0)
 
         try:
             elixir.session.commit()
 
         try:
             elixir.session.commit()
@@ -49,7 +51,7 @@ class ArtController(BaseController):
         if c.user:
             c.your_score = c.art.user_score(c.user)
         return render("/art/show.mako")
         if c.user:
             c.your_score = c.art.user_score(c.user)
         return render("/art/show.mako")
-        
+
 
     # TODO: login required
     def rate(self, id):
 
     # TODO: login required
     def rate(self, id):
@@ -59,8 +61,8 @@ class ArtController(BaseController):
             score = int(score)
         else:
             score = Rating.reverse_options.get(score)
             score = int(score)
         else:
             score = Rating.reverse_options.get(score)
-        
+
         c.art.rate(score, c.user)
         elixir.session.commit()
         c.art.rate(score, c.user)
         elixir.session.commit()
-            
+
         redirect(url('show_art', id=c.art.id))
         redirect(url('show_art', id=c.art.id))