Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9252 closed (fixed)

IncorrectLookupParameters not being raised in admin get_query_set

Reported by: leanmeandonothingmachine Owned by: kmtracey
Component: contrib.admin Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Somehow in the refactoring of admin, the redirect to ERROR_FLAG functionality got lost. In the ChangeList class, the try except is in get_results but the error gets thrown from get_query_set. So if there are invalid url args, the actual field error gets thrown which is a problem on production servers.

Change History (7)

comment:1 Changed 7 years ago by leanmeandonothingmachine

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

That should say gets raised, not thrown.

comment:2 Changed 7 years ago by kmtracey

Clarification of how to recreate the problem would be helpful here. I'm thinking you are talking about things like manually tweaking a filter lookup parameter in the url. Getting it wrong used to just get you redirected to the unfiltered change list page with a special error parameter in the url that gave you a clue (if you knew what it meant) what had happened. Now I see that doesn't happen, instead you get, for example, a FieldError raised. Is this what you are talking about or something else?

comment:3 Changed 7 years ago by leanmeandonothingmachine

yes that's what I'm talking about. something like /admin/myapp/mymodel/?notafield=foo. As you said it used to redirect and the code for that is still in there just in a different place.

comment:4 Changed 7 years ago by kmtracey

  • Triage Stage changed from Unreviewed to Accepted

comment:5 Changed 7 years ago by kmtracey

  • Owner changed from nobody to kmtracey
  • Status changed from new to assigned

This actually happened when queryset-refactor got merged to trunk, not when newforms-admin came in. Apparently the error that used to be caught later is now caught sooner in the query code.

comment:6 Changed 7 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [9246]) [1.0.X] Fixed #9252 -- Moved the try/except protecting against incorrect lookup params to where the error is now raised, and added a test for this case.

Backport of [9245] from trunk.

comment:7 Changed 7 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

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