[Django]-Django many-to-many

7👍

just put related_name into actors field

actors = models.ManyToManyField(Actor, related_name="actor_movies")

and then in template:

{{ actor.actor_movies.all }}

or if you dont want related_name:

template:

{{ actor.movie_set.all }}

Leave a comment