1👍
✅
You can access the Game
s with:
my_license.game_set.all()
so you can use self
in the getGamesOnThisLicense
, but probably there is not much gain to define a function since this makes accessing the Game
s already quite convenient.
Perhaps you however want to transform the ManyToManyField
into a ForeignKey
to License
since self.license.name
makes not much sense: for a ManyToManyField
, self.license
is a Manager
over License
objects that can manage zero, one or more License
s, so you can not use self.license.name
.
Source:stackexchange.com