diff options
author | Jessica Tallon <tsyesika@tsyesika.se> | 2015-09-17 13:47:56 +0200 |
---|---|---|
committer | Jessica Tallon <tsyesika@tsyesika.se> | 2015-10-07 14:40:44 +0200 |
commit | 0f3bf8d4b180ffd1907d1578e087522aad7d9158 (patch) | |
tree | 22279f7ff895047d1ec3c68bedb69a081cc0871a /mediagoblin/edit | |
parent | 80ba8ad1d1badb2f6330f25c540dc413e42e7d5c (diff) | |
download | mediagoblin-0f3bf8d4b180ffd1907d1578e087522aad7d9158.tar.lz mediagoblin-0f3bf8d4b180ffd1907d1578e087522aad7d9158.tar.xz mediagoblin-0f3bf8d4b180ffd1907d1578e087522aad7d9158.zip |
Collection changes and migration for federation
- Adds a "type" column to the Collection object and allows the
CollectionItem model to contain any object.
- Changes "items" to "num_items" as per TODO
- Renames "uploader", "creator" and "user" to a common "actor" in most places
Diffstat (limited to 'mediagoblin/edit')
-rw-r--r-- | mediagoblin/edit/lib.py | 2 | ||||
-rw-r--r-- | mediagoblin/edit/views.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/mediagoblin/edit/lib.py b/mediagoblin/edit/lib.py index 6acebc96..3f52376a 100644 --- a/mediagoblin/edit/lib.py +++ b/mediagoblin/edit/lib.py @@ -17,7 +17,7 @@ def may_edit_media(request, media): """Check, if the request's user may edit the media details""" - if media.uploader == request.user.id: + if media.actor == request.user.id: return True if request.user.has_privilege(u'admin'): return True diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index af0d0e9b..8e80b3ce 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -73,7 +73,7 @@ def edit_media(request, media): # Make sure there isn't already a MediaEntry with such a slug # and userid. slug = slugify(form.slug.data) - slug_used = check_media_slug_used(media.uploader, slug, media.id) + slug_used = check_media_slug_used(media.actor, slug, media.id) if slug_used: form.slug.errors.append( @@ -350,12 +350,12 @@ def edit_collection(request, collection): if request.method == 'POST' and form.validate(): # Make sure there isn't already a Collection with such a slug # and userid. - slug_used = check_collection_slug_used(collection.creator, + slug_used = check_collection_slug_used(collection.actor, form.slug.data, collection.id) # Make sure there isn't already a Collection with this title existing_collection = request.db.Collection.query.filter_by( - creator=request.user.id, + actor=request.user.id, title=form.title.data).first() if existing_collection and existing_collection.id != collection.id: @@ -376,7 +376,7 @@ def edit_collection(request, collection): return redirect_obj(request, collection) if request.user.has_privilege(u'admin') \ - and collection.creator != request.user.id \ + and collection.actor != request.user.id \ and request.method != 'POST': messages.add_message( request, messages.WARNING, |