Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#9252 closed (fixed)

IncorrectLookupParameters not being raised in admin get_query_set

Reported by: leanmeandonothingmachine Owned by: Karen Tracey
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: no UI/UX: no


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 10 years ago by leanmeandonothingmachine

That should say gets raised, not thrown.

comment:2 Changed 10 years ago by Karen Tracey

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 10 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 10 years ago by Karen Tracey

Triage Stage: UnreviewedAccepted

comment:5 Changed 10 years ago by Karen Tracey

Owner: changed from nobody to Karen Tracey
Status: newassigned

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 10 years ago by Karen Tracey

Resolution: fixed
Status: assignedclosed

(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 10 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

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