added filtering by entry state in processing panel

This commit is contained in:
Boris Bobrov
2014-08-16 17:41:37 +03:00
parent be9262b4d4
commit 906a00b667
4 changed files with 29 additions and 5 deletions

View File

@@ -97,6 +97,11 @@ add_route('mediagoblin.user_pages.processing_panel',
'/u/<string:user>/panel/',
'mediagoblin.user_pages.views:processing_panel')
add_route('mediagoblin.user_pages.processing_panel',
'/u/<string:user>/panel/<any(processed, processing, failed):state>/',
'mediagoblin.user_pages.views:processing_panel')
# Stray edit routes
add_route('mediagoblin.edit.edit_media',
'/u/<string:user>/m/<int:media_id>/edit/',

View File

@@ -653,11 +653,18 @@ def processing_panel(request):
return redirect(
request, 'mediagoblin.user_pages.user_home',
user=user.username)
# Get media entries which are in-processing
entries = (MediaEntry.query.filter_by(uploader=user.id)
.order_by(MediaEntry.created.desc()))
try:
state = request.matchdict['state']
# no exception was thrown, filter entries by state
entries = entries.filter_by(state=state)
except KeyError:
# show all entries
pass
# Render to response
return render_to_response(
request,