Apology if this is a duplicate but I could not find any satisfying answer for this case. Maybe I am doing something fundamentally wrong, like need to define models in a different way.I am also very new to django.So suggestions will be really helpful.
Suppose I have my models like this:
from django.contrib.auth.models import Group
class Team(Group):
description = models.CharField(max_length=30)
class Players(models.Model):
name = models.CharField(max_length=60)
team = models.ForeignKey(Team, on_delete=models.CASCADE)
Now if I for example, want a queryset of all players by the Team model what can I do?
I have the foreign key in the Players model and not in Team model. So something like Team.objects.filter(logic) is needed to get all players. But exactly what logic will work here?
Any help will be much appreciated.