diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2011-05-27 00:17:30 +0200 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2011-05-27 00:17:30 +0200 |
commit | 98857207ccb432117709f64137ca20f81635f288 (patch) | |
tree | cd0648bd2c2258ebe9d807783c010fc5a4232eb0 /mediagoblin/edit/views.py | |
parent | 8782001bf0002143f412e9612e97939f57d63ffe (diff) | |
download | mediagoblin-98857207ccb432117709f64137ca20f81635f288.tar.lz mediagoblin-98857207ccb432117709f64137ca20f81635f288.tar.xz mediagoblin-98857207ccb432117709f64137ca20f81635f288.zip |
"edit": Finally implement saving.
Currently no checks. Probably not so good.
And especially, every logged in user currently can edit the
data for any other user's media.
Diffstat (limited to 'mediagoblin/edit/views.py')
-rw-r--r-- | mediagoblin/edit/views.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index 11dd58be..050ece4e 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -1,6 +1,6 @@ -from webob import Response +from webob import Response, exc from mediagoblin.edit import forms from mediagoblin.decorators import require_active_login, get_media_entry_by_id @@ -13,6 +13,17 @@ def edit_media(request, media): slug = media['slug'], description = media['description']) + if request.method == 'POST' and form.validate(): + media['title'] = request.POST['title'] + media['description'] = request.POST['description'] + media['slug'] = request.POST['slug'] + media.save() + + # redirect + return exc.HTTPFound( + location=request.urlgen("mediagoblin.user_pages.media_home", + user=media.uploader()['username'], media=media['_id'])) + # render template = request.template_env.get_template( 'mediagoblin/edit/edit.html') |