Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#16751 closed Bug (needsinfo)

GET variable names replaced by 'e'

Reported by: martopolis@… Owned by: nobody
Component: contrib.admin Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by jezdez)

I'm attempting to override the queryset() method to make a custom filter for the Change List Admin view. The idea was to append ?myview=1 to the URL and then check it like so:

if request.GET['myview'] == '1':
…

But everything I pass via the URL string is being replaced by the key name 'e' in the GET dictionary:

"Key 'myview' not found in <QueryDict: {u'e': [u'1']}>"

Curiously, this also happens in the final URL string. That is, the URL gets rewritten and redirected to ?e=1 as well.

Attachments (0)

Change History (5)

comment:1 Changed 3 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Bad formatting, let's see if this works:

if request.GET['myview'] == '1': ..

comment:2 Changed 3 years ago by jezdez

  • Description modified (diff)
  • Resolution set to needsinfo
  • Status changed from new to closed

Without further explanation or concrete code example I can't reproduce this.

comment:3 Changed 3 years ago by anonymous

I've noticed this only happens when opening a model change list view. That is, if I try to load http://mysite/admin/?variable=1, there's no problem. But when I try http://mysite/admin/myproject/model/?variable=1. the 'variable' portion gets rewritten as 'e'.

comment:4 Changed 3 years ago by julien

Custom filters only exist in the development version and will be available in 1.4. The redirection with "?e=1" is when some GET parameters are recognized as invalid; see: source:django/trunk/django/contrib/admin/options.py?rev=16602#L1102 (in dev version, but same in 1.3)

comment:5 Changed 3 years ago by anonymous

julien: Thanks for pointing to me to code in question. I see I can probably 'fix' this by just commenting out that block of code and adding 'pass' to the 'except' statement. Don't you think that Django should support passing custom parameters via GET in the changelist_view, though?

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.