I currently have a single Django model (lets call it Book) being made available via a ModelViewSet.
I want to add a second model (call it Author) with a foreign key to Book. I want to insist that whenever a Book is created an Author is also created at the same time. It should not be possible to create a Book without an Author. I have determined that it's impossible to do this using Django in models.py. I know there must be a way to do it with DRF in serializers.py and/or views.py, but I've been unable to figure out the best way to do it. I've tried a few different things, but keep hitting nonsensical roadblocks, and I think that I conceptually just don't know the best way to assemble DRF to achieve this. Any suggestions? -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/446238cc-5e69-4044-afe5-02a97b403793%40googlegroups.com.
