NOT NULL constraint failed: snippets_snippet.owner_id
shadan76 opened this issue · 4 comments
I am new to the programming and following the tutorial as it is. But can't seem to get past the 4th chapter "Authentication and permissions". At the end of the tutorial I'm trying to create the snippet programmatically but I'm getting error "NOT NULL constraint failed: snippets_snippet.owner_id" . Am I missing something ?
You probably missed this section
Please note that the discussion group is the best place to take this discussion and other usage questions. Thanks!
I did as the tutorial said. Apparently "APIView" class has no method named "perform_create()" . So I tried inheriting the view with "CreateAPIView" and "ListCreateAPIView" from generics but to no avail.
Вероятно мы учим по одному учебнику и вы, возможно, ошиблись там же где и я, метод perform_create следует объявлять у класса SnippedList, а я его по ошибке в другой запихнул
@shadan76 For people having this problem:
I didn't have follow the exact steps of 3th chapter. All I had to do was put my classes in views exactly the same as was put (using generics.ListCreateAPIView).
Now it's working!