Why can't I filter on this related field anymore after upgrading Django versions?

Ok, that does narrow it down a great deal. My next attempt would then be to try the intermediate step - Car.objects.all(carcategory__car_category_id=<some known value>) to see whether or not it’s seeing the reverse-relationship at all.

I’m wondering if this is a bug that was resolved in a later release. I created a model structure similar to yours and have no problems with that type of query in my test environment.

I did some digging through the old Django tickets, and only found one that appears to be close (sorry, lost track of the number). In that particular case, it was a user error in that they were using a module that changed an attribute on the model. That attribute name wasn’t used in older versions of Django but is being used now, so that module was overwriting what Django was using, causing Django to fail. (I believe the attribute is “field_name”)

I would also make quadrupally sure that I don’t have any other models anywhere in the application (or in any 3rd-party apps installed) with the same name as any of these.

I’m still looking for other possibilities…

Ken

1 Like