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.