ef3c7ce73431bc2dee4f6c2f17fd8534021c5256
[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('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["tags"], c.user)
27 elixir.session.commit()
28 redirect(url('art', id=c.art.id))
29