Changes between Initial Version and Version 4 of Ticket #16714


Ignore:
Timestamp:
Aug 27, 2011, 9:41:18 AM (13 years ago)
Author:
Julien Phalip
Comment:

Some further investigation shows that the problem has nothing to do with the type of field (SmallIntegerField, CharField, ...) -- the issue is in fact with the *name* of the field. The same "TypeError: Related Field has invalid lookup: xxxx" exception is raised for any fields named year, month or day on the related model. There is obviously some sort of conflict with the date lookup system, although it seems strange that the RelatedField isn't more smart about it. It's also strange that this issue didn't surface for all those years as the use case is quite trivial...

There's still a regression with the way the admin changelist handles exceptions (the dev version crashes with a 500 instead of redirecting) and I've created a separate ticket for that: #16716.

Let's keep this ticket here to discuss the ORM issue. This is not a regression though, as it already existed at least in 1.3, so I'm removing the 'blocker' flag.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16714

    • Property Triage Stage UnreviewedAccepted
    • Property Component contrib.adminDatabase layer (models, ORM)
    • Property Summary Can't list_filter across a relationship on a SmallIntegerFieldCan't filter by a related object's field called 'year', 'month' or 'day'
  • Ticket #16714 – Description

    initial v4  
     1UPDATE: The problem was originally reported in the admin but it appears it is rather an issue with the ORM -- see discussion below.
     2
    13If you have a SmallIntegerField on a model that is related via a foreign key then you can't use that field as an option in list_filter. Doing so gives you the correct distinct options in the list page sidebar, but if you try to select any of them you receive a 302 redirect to /?e=1, as if you had used an unexpected query-string parameter.
    24
Back to Top