Is it possible in Django to use eager loading for property decorator?
My code as example
class Player(models.Model):
roles = models.ManyToManyField(Role, related_name='players')
@property
def role(self):
return ", ".join([r.name for r in self.roles.all().order_by('name')])
When outputting the player role using the property, it runs a query each time.
Actually I still don't know how eager load works in general with Django. I can't find any good docs about it.
Thanks