#18530 closed Bug (fixed)
Inconsistent error handling on admin filter url's
| Reported by: | 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)
Change History (8)
by , 13 years ago
| Attachment: | 18530.admin-filter-500.diff added |
|---|
comment:1 by , 13 years ago
| Resolution: | → worksforme |
|---|---|
| Status: | new → closed |
comment:2 by , 13 years ago
| Resolution: | worksforme |
|---|---|
| Status: | closed → reopened |
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 , 13 years ago
| Attachment: | 18530-admin-filter-incorrect-lookup.diff added |
|---|
comment:3 by , 13 years ago
| Has patch: | set |
|---|---|
| Severity: | Normal → Release blocker |
| Triage Stage: | Unreviewed → Accepted |
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 , 13 years ago
| Owner: | changed from to |
|---|---|
| Status: | reopened → new |
I'll try and get that committed soon.
comment:5 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
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!