I have a very simple question and I'm surprised it hasn't been asked before on this website. I have the two following models:
# models.py
class Film(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=150)
genre = models.ManyToManyField(Genre)
class Genre(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=100, unique=True)
I need to make an API that gets 2 integers, id of movie and id of genre, and adds the said genre to the movie. seems very simple but I don't know how I could do this. I could really use the help.