aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2013-08-16 11:23:22 +0300
committerRodney Ewing <ewing.rj@gmail.com>2013-08-17 09:44:02 -0700
commite7b8059f17c98ee88d933af52b0c4d858e882e8e (patch)
tree537483d0c35c773e0b8f86d7a7465fe638617212
parente7c08e3550d19691d989d48d8d499eb7b2b9f80a (diff)
downloadmediagoblin-e7b8059f17c98ee88d933af52b0c4d858e882e8e.tar.lz
mediagoblin-e7b8059f17c98ee88d933af52b0c4d858e882e8e.tar.xz
mediagoblin-e7b8059f17c98ee88d933af52b0c4d858e882e8e.zip
media_confirm_delete: redirect to next, then prev, then user home
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>
-rw-r--r--mediagoblin/user_pages/views.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 91ea04b8..9d3cb08b 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -301,8 +301,12 @@ def media_confirm_delete(request, media):
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,