Django “can’t set attribute” in model

The problem was a name clash.

Apparently when querying the DB I had:

objs = MyReport.objects.annotate(location=F('test__location'))

This added location to the objects (didn’t see it in __dict__, but maybe I just missed it). This means I could give up the property since I could call report_instance.location. Of course, this means that all places that access MyReport I need to add the annotation (a special manager?).

Leave a Comment

tech