5d13789a7feceea30a2c6b38333c5c6d843a408d
4 from pylons
import request
, response
, session
, tmpl_context
as c
, url
5 from pylons
.controllers
.util
import abort
, redirect
8 from floof
.model
import Art
, ArtUser
, ArtUserType
, Tag
, TagText
, User
9 from floof
.lib
import helpers
as h
10 from floof
.lib
.base
import BaseController
, render
11 from floof
.lib
.tags
import add_tags
12 from floof
.lib
.dbhelpers
import find_or_create
14 log
= logging
.getLogger(__name__
)
16 class TagController(BaseController
):
18 # TODO: login required
19 def delete(self
, art_id
, id):
20 tag
= h
.get_object_or_404(Tag
, id=id)
21 elixir
.session
.delete(tag
)
22 elixir
.session
.commit()
23 redirect(url('show_art', id=art_id
))
25 # TODO: login required
26 def create(self
, art_id
):
27 c
.art
= h
.get_object_or_404(Art
, id=art_id
)
29 tag_string
= request
.params
.get('tags', '')
30 add_tags(c
.art
, tag_string
, c
.user
)
33 redirect(url('show_art', id=c
.art
.id))