Opened 6 years ago

Closed 4 years ago

#10824 closed (duplicate)

GET infos is lost

Reported by: roboter <songbf@…> Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: GET info
Cc: Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

on the django admin,i new a model with GET info,the url is like:/admin/xxapp/a/add/?name=test.[[BR]]

but when click "Save and add another",the new url is "/admin/xxapp/a/add/","?name=test" had losted.

i goto django/contrib/admin/options.py,find a function:

def response_add(self, request, obj, post_url_continue='../%s/'):
   ...
   elif request.POST.has_key("_addanother"):
      self.message_user(request, msg + ' ' + (_("You may add another %s below.") % force_unicode(opts.verbose_name)))
      return HttpResponseRedirect(request.path)

this code lost GET info,please fix.
and i write some code:

getinfos = request.GET.items()
gets = '?'
for info in getinfos:
    gets += '%s=%s&' % (info[0],info[1])

path = request.path + gets
return HttpResponseRedirect(path)

Change History (3)

comment:1 Changed 6 years ago by mtredinnick

  • milestone 1.1 deleted
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

This is a feature addition, not a bug fix to documented behaviour. We're not currently guaranteeing that query parameters are passed to the "add" option. Worth thinking about for a future release, though (scoping out the full problem for all admin resources is going to be necessary).

Removing from the 1.1 milestone.

comment:2 Changed 6 years ago by SmileyChris

  • Triage Stage changed from Unreviewed to Someday/Maybe

comment:3 Changed 4 years ago by julien

  • Resolution set to duplicate
  • Status changed from new to closed

This is a dupe of #12241 which, although it is more recent, contains more thorough discussions and has patches.

Note: See TracTickets for help on using tickets.
Back to Top