Ticket #2382: 2382.patch
File 2382.patch, 3.5 KB (added by , 18 years ago) |
---|
-
contrib/admin/views/main.py
269 269 (pk_value, str(new_object).replace('"', '\\"'))) 270 270 elif request.POST.has_key("_addanother"): 271 271 request.user.message_set.create(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name)) 272 return HttpResponseRedirect(request.path )272 return HttpResponseRedirect(request.path + '?' + request.GET.urlencode()) 273 273 else: 274 274 request.user.message_set.create(message=msg) 275 return HttpResponseRedirect(post_url )275 return HttpResponseRedirect(post_url + '?' + request.GET.urlencode()) 276 276 else: 277 277 # Add default data. 278 278 new_data = manipulator.flatten_data() … … 348 348 if request.REQUEST.has_key('_popup'): 349 349 return HttpResponseRedirect(request.path + "?_popup=1") 350 350 else: 351 return HttpResponseRedirect(request.path )351 return HttpResponseRedirect(request.path + '?' + request.GET.urlencode()) 352 352 elif request.POST.has_key("_saveasnew"): 353 353 request.user.message_set.create(message=_('The %(name)s "%(obj)s" was added successfully. You may edit it again below.') % {'name': opts.verbose_name, 'obj': new_object}) 354 return HttpResponseRedirect("../%s/" % pk_value )354 return HttpResponseRedirect("../%s/" % pk_value + '?' + request.GET.urlencode()) 355 355 elif request.POST.has_key("_addanother"): 356 356 request.user.message_set.create(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name)) 357 return HttpResponseRedirect("../add/" )357 return HttpResponseRedirect("../add/" + '?' + request.GET.urlencode()) 358 358 else: 359 359 request.user.message_set.create(message=msg) 360 return HttpResponseRedirect("../" )360 return HttpResponseRedirect("../" + '?' + request.GET.urlencode()) 361 361 else: 362 362 # Populate new_data with a "flattened" version of the current data. 363 363 new_data = manipulator.flatten_data() … … 736 736 return qs 737 737 738 738 def url_for_result(self, result): 739 return "%s/" % quote(getattr(result, self.pk_attname)) 739 return "%s/" % quote(getattr(result, self.pk_attname)) + self.get_query_string() 740 740 741 741 def change_list(request, app_label, model_name): 742 742 model = models.get_model(app_label, model_name) -
contrib/admin/templates/admin/change_list.html
8 8 {% block content %} 9 9 <div id="content-main"> 10 10 {% if has_add_permission %} 11 <ul class="object-tools"><li><a href="add/{% if is_popup %}?_popup=1{% e ndif %}" class="addlink">{% blocktrans with cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans %}</a></li></ul>11 <ul class="object-tools"><li><a href="add/{% if is_popup %}?_popup=1{% else %}{{ cl.get_query_string }}{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans %}</a></li></ul> 12 12 {% endif %} 13 13 <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist"> 14 14 {% block search %}{% search_form cl %}{% endblock %}