Use serializer of model having foreign key to do CRUD on parent table in Django Rest Framework
In my API, I have two models Question and Option as shown below class Question(models.Model): body = models.TextField() class Options(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) option = models.CharField(max_length=100) is_correct = models.SmallIntegerField() While creating a question it would be nicer the options can be created at the same time. And already existed question should not be created but the options can be changed if the options are different from previous. I am using ModelSerializer and ModelViewSet . I use different urls and views for Question