We have three models, Artist
:
class Artist(models.Model):
family_name = models.CharField(max_length=50)
given_name = models.CharField(max_length=50)
Group
:
class Group(models.Model):
name = models.CharField(max_length=50)
members = models.ManyToManyField(Artist, through='Membership')
and Membership
:
class Membership(models.Model)
artist = models.ForeignKey(Artist)
group = models.ForeignKey(Group)
joined = models.DateField()
Membership
is an intermediary model connecting Artist
and Group
with some extra data (date joined, etc.) I was asked to see if one could filter artists by what group they're in but I can't figure out how to do that.