(project is available on github with that problem)
For some reason serializer's depth option makes fields ignored on create.
Serializer:
class AnswerSerializer(serializers.ModelSerializer):
class Meta:
model = Answer
fields = ('question', 'body',)
depth = 1
View:
class AnswerList(ListCreateAPIView):
queryset = Answer.objects.all()
serializer_class = AnswerSerializer
When I try to create an answer with depth = 1 I get NOT NULL constraint failed: forum_answer.question_id, but when I comment out depth = 1 everything works. But of course I don't get a full Question object, only pk of it.