import elixir
from floof.model.art import Art, Rating
+from floof.model.comments import Discussion
from sqlalchemy.exceptions import IntegrityError
# TODO: login required
def create(self):
c.art = Art(uploader=c.user, **request.params)
+ c.art.discussion = Discussion(count=0)
try:
elixir.session.commit()
if c.user:
c.your_score = c.art.user_score(c.user)
return render("/art/show.mako")
-
+
# TODO: login required
def rate(self, id):
score = int(score)
else:
score = Rating.reverse_options.get(score)
-
+
c.art.rate(score, c.user)
elixir.session.commit()
-
+
redirect(url('show_art', id=c.art.id))