Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#18530 closed Bug (fixed)

Inconsistent error handling on admin filter url's

Reported by: david@… Owned by: Julien Phalip
Component: contrib.admin Version: 1.4
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This probably isn't officially supported but there is a curious change to error handling introduced in Django 1.4.

In 1.3 something like

/admin/app/model/?date__gte=moo

would yield e=1 and no 500 error

In 1.4 I get a 500 instead. But only for dates!

?id__gte=moo

yields a e=1

Perhaps this type of hard filtering should just be scorned all together. But I do find it quite useful and a 500 error in such particular situations is odd behavior. I've implemented a hack start and end date filter which is why I've gotten this. Ugly I know.

Attachments (2)

18530.admin-filter-500.diff (1.4 KB ) - added by Julien Phalip 12 years ago.
18530-admin-filter-incorrect-lookup.diff (3.1 KB ) - added by Julien Phalip 12 years ago.

Download all attachments as: .zip

Change History (8)

by Julien Phalip, 12 years ago

Attachment: 18530.admin-filter-500.diff added

comment:1 by Julien Phalip, 12 years ago

Resolution: worksforme
Status: newclosed

I can't seem to reproduce the problem. See the attached patch, where the test passes.

If you can provide a failing test, please do reopen this ticket. Thanks!

comment:2 by david@…, 12 years ago

Resolution: worksforme
Status: closedreopened

It appears linked to having a list_filter on the tested date such as
list_filter = date

In the django regression test you linked, try changing admin.py

class ThingAdmin(admin.ModelAdmin):
    list_filter = ('color__warm', 'color__value')

to

class ThingAdmin(admin.ModelAdmin):
    list_filter = ('color__warm', 'color__value', 'date')

then you should get the error.

by Julien Phalip, 12 years ago

comment:3 by Julien Phalip, 12 years ago

Has patch: set
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

I've attached a suggested fix. I'll let someone else review it, and if that's fine then I'll also backport it to 1.4.x to address this small regression.

comment:4 by Julien Phalip, 12 years ago

Owner: changed from nobody to Julien Phalip
Status: reopenednew

I'll try and get that committed soon.

comment:5 by Julien Phalip <jphalip@…>, 12 years ago

Resolution: fixed
Status: newclosed

In 336dfc3413b22bc5a5008bba7ff383886da96d60:

[1.4.X] Fixed #18530 -- Fixed a small regression in the admin filters where wrongly formatted dates passed as url parameters caused an unhandled ValidationError. Thanks to david for the report.

comment:6 by Julien Phalip <jphalip@…>, 12 years ago

In c555741aa7840d8ee4b3a191550924cca6f27105:

Fixed #18530 -- Fixed a small regression in the admin filters where wrongly formatted dates passed as url parameters caused an unhandled ValidationError. Thanks to david for the report.

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