655: Fix collection fetching for media_collect()
The problem is: Collection.query.filter_by(id=X, ...) 1. X = form.collection.data This works nicely for the completely empty form (X = None). It does not work for a selected collection, because X will be the collection, not its id. 2. X = request.form.get('collection') (old code). This one works mostly, except for the completely empty form on postgres, because in this case X = u"__None" and postgres does not like comparing an integer column with a string. Fix: collection = form.collection.data if collection and collection.creator != request.user.id: collection = None
This commit is contained in:
parent
8da8449332
commit
e9330b9552
@ -226,9 +226,9 @@ def media_collect(request, media):
|
|||||||
|
|
||||||
# Otherwise, use the collection selected from the drop-down
|
# Otherwise, use the collection selected from the drop-down
|
||||||
else:
|
else:
|
||||||
collection = Collection.query.filter_by(
|
collection = form.collection.data
|
||||||
id=form.collection.data,
|
if collection and collection.creator != request.user.id:
|
||||||
creator=request.user.id).first()
|
collection = None
|
||||||
|
|
||||||
# Make sure the user actually selected a collection
|
# Make sure the user actually selected a collection
|
||||||
if not collection:
|
if not collection:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user