Ticket #12241: keep_query_string_after_continue.diff
File keep_query_string_after_continue.diff, 2.3 KB (added by , 15 years ago) |
---|
-
django/contrib/admin/options.py
589 589 "admin/change_form.html" 590 590 ], context, context_instance=context_instance) 591 591 592 def handle_continue_redirect(self, request, url_continue, msg): 593 self.message_user(request, msg + ' ' + _("You may edit it again below.")) 594 if request.POST.has_key("_popup"): 595 url_continue += ("?_popup=1" + request.META.get('QUERY_STRING')) 596 else: 597 url_continue += ("?" + request.META.get('QUERY_STRING')) 598 return url_continue 599 592 600 def response_add(self, request, obj, post_url_continue='../%s/'): 593 601 """ 594 602 Determines the HttpResponse for the add_view stage. … … 600 608 # Here, we distinguish between different save types by checking for 601 609 # the presence of keys in request.POST. 602 610 if request.POST.has_key("_continue"): 603 self.message_user(request, msg + ' ' + _("You may edit it again below.")) 604 if request.POST.has_key("_popup"): 605 post_url_continue += "?_popup=1" 611 url = self.handle_continue_redirect(request, post_url_continue, msg) 606 612 return HttpResponseRedirect(post_url_continue % pk_value) 607 613 608 614 if request.POST.has_key("_popup"): … … 633 639 634 640 msg = _('The %(name)s "%(obj)s" was changed successfully.') % {'name': force_unicode(opts.verbose_name), 'obj': force_unicode(obj)} 635 641 if request.POST.has_key("_continue"): 636 self.message_user(request, msg + ' ' + _("You may edit it again below.")) 637 if request.REQUEST.has_key('_popup'): 638 return HttpResponseRedirect(request.path + "?_popup=1") 639 else: 640 return HttpResponseRedirect(request.path) 642 url = self.handle_continue_redirect(request, request.path, msg) 643 return HttpResponseRedirect(url) 641 644 elif request.POST.has_key("_saveasnew"): 642 645 msg = _('The %(name)s "%(obj)s" was added successfully. You may edit it again below.') % {'name': force_unicode(opts.verbose_name), 'obj': obj} 643 646 self.message_user(request, msg)