4f9899480e2d6760ecc50026cf642fcb3a0c2433
[zzz-floof.git] / floof / controllers / tag.py
1 import logging
2
3 from pylons import request, response, session, tmpl_context as c, h
4 from pylons.controllers.util import abort, redirect
5
6 from floof.lib.base import BaseController, render
7 from pylons import url
8
9 log = logging.getLogger(__name__)
10
11 import elixir
12 from floof.model.art import Art, Tag
13
14 class TagController(BaseController):
15
16 # TODO: login required
17 def delete(self, art_id, id):
18 tag = h.get_object_or_404(Tag, id=id)
19 elixir.session.delete(tag)
20 elixir.session.commit()
21 redirect(url('show_art', id=art_id))
22
23 # TODO: login required
24 def create(self, art_id):
25 c.art = h.get_object_or_404(Art, id=art_id)
26 c.art.add_tags(request.params.get("tags",""), c.user)
27 elixir.session.commit()
28 redirect(url('show_art', id=c.art.id))
29