I'm not sure what this error means or how to resolve it. I'm guessing it's because in my model I'm trying to assign a field to the value of the average of all the many2many's from another field. But I can do this at the command line happily, yet when I put it on a submethod I can't do it, so I don't understand what's going wrong.
This works: x.field_name = x.m2m_set.filter(condition).aggregate(avg=Avg('m2m_subfield__score'))['avg'] x.save() Yes including the method on the model for x as follows: def calculate_score(self): -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANOQRbyNgC4%3DTSMHnobqbW_LdPKP%3DoWStnSuNViwR3x%2BQyHF%2Bg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.