Instead of redirecting directly to user's home. Makes the flow for mass or just
a few deletions easier. For really large deletions it would still make sense to
have a dedicated view, but this is still way better then losing context by
jumping back to the home view.
Signed-off-by: Alon Levy <alon@pobox.com>
messages.add_message(
request, messages.SUCCESS, _('You deleted the media.'))
- return redirect(request, "mediagoblin.user_pages.user_home",
- user=username)
+ location = media.url_to_next(request.urlgen)
+ if not location:
+ location=media.url_to_prev(request.urlgen)
+ if not location:
+ location="mediagoblin.user_pages.user_home"
+ return redirect(request, location=location, user=username)
else:
messages.add_message(
request, messages.ERROR,