Django queryset with Model method containing another queryset
问题 Suppose I have a model, MyModel , with a property method that uses another model's queryset. class OtherModel(models.Model) ... class MyModel(models.Model): simple_attr = models.CharField('Yada yada') @property def complex_attr(self): list_other_model = OtherModel.objects.all() ... # Complex algorithm using queryset from 'OtherModel' and simple_attr return result This causes my get_queryset() method on MyModel to query the database to generate the list_other_model variable every time for