[Debconf-video-commits] r400 - package/branches/pycon09/src/pyconvideo/pyconvideo

benh at alioth.debian.org benh at alioth.debian.org
Thu Mar 26 21:47:27 UTC 2009


Author: benh
Date: 2009-03-26 21:47:27 +0000 (Thu, 26 Mar 2009)
New Revision: 400

Modified:
   package/branches/pycon09/src/pyconvideo/pyconvideo/views.py
Log:
Clean up display of completion messages:
- Redirect to list display instead of showing it at the review URL
- Use query parameter to indicate that a review was completed


Modified: package/branches/pycon09/src/pyconvideo/pyconvideo/views.py
===================================================================
--- package/branches/pycon09/src/pyconvideo/pyconvideo/views.py	2009-03-26 21:37:05 UTC (rev 399)
+++ package/branches/pycon09/src/pyconvideo/pyconvideo/views.py	2009-03-26 21:47:27 UTC (rev 400)
@@ -1,6 +1,7 @@
 from django import forms
 from django.contrib.auth.decorators import login_required
 from django.db import transaction
+from django.http import HttpResponseRedirect
 from django.shortcuts import render_to_response, get_object_or_404
 from django.template import defaultfilters
 import mx.DateTime
@@ -15,10 +16,10 @@
     value = unicode(re.sub('[^\w\s_]', '', value).strip())
     return defaultfilters.mark_safe(re.sub('[_\s]+', '_', value))
 
-def list_recordings(request, completed=False):
+def list_recordings(request):
     return render_to_response(
         'pyconvideo/videorecording_list.html',
-        {'completed': completed,
+        {'completed': request.GET.get('completed'),
          'object_list':
              models.VideoRecording.objects.all().order_by('recording_time').select_related(),
          'user': request.user})
@@ -64,7 +65,6 @@
 @transaction.commit_on_success
 def review_recording(request, recording_id):
     recording = get_object_or_404(models.VideoRecording, pk=recording_id)
-    completed = False
 
     # lock or fail
     if not recording.locked_by:
@@ -108,11 +108,10 @@
             event_recording.save()
 
             if request.POST.get('finish'):
-                return list_recordings(request, completed=True)
+                return HttpResponseRedirect('/recording/?completed=1')
             else:
-                # go back to the list of events, but acknowledge
-                # completion
-                completed = True
+                return HttpResponseRedirect('/recording/%d/review?completed=1'
+                                            % recording.id)
         else:
             # try again
             return render_to_response('pyconvideo/review_event_recording.html',
@@ -125,7 +124,7 @@
             models.VideoFileStatus.objects.get(file_status_code='D')
         recording.locked_by = None
         recording.save()
-        return list_recordings(request, completed=True)
+        return HttpResponseRedirect('/recording/?completed=1')
 
     elif event:
         # show main form
@@ -157,7 +156,7 @@
         order_by=['proximity'])
     events = events.all()
     return render_to_response('pyconvideo/review_list_events.html',
-                              {'completed': completed,
+                              {'completed': request.GET.get('completed'),
                                'recording': recording,
                                'events': events})
 
@@ -175,7 +174,8 @@
                 target = None
             files[-1]['target'].append(target)
     return render_to_response('pyconvideo/videotargetfile_list.html',
-                              {'files': files,
+                              {'completed': request.GET.get('completed'),
+                               'files': files,
                                'formats': formats,
                                'user': request.user})
 
@@ -210,7 +210,7 @@
             target.comments = data['comments']
             target.locked_by = None
             target.save()
-            return list_targets(request, completed=True)
+            return HttpResponseRedirect('/target/?completed=1')
         else:
             # try again
             return render_to_response('pyconvideo/review_target.html',




More information about the Debconf-video-commits mailing list