mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-17 03:51:03 +03:00
The pre_save method no longer works. This resolved issue #2306
This commit is contained in:
parent
b8af83493f
commit
7e9aac98fe
|
@ -44,8 +44,8 @@ Next we're going to replace the `SnippetList`, `SnippetDetail` and `SnippetHighl
|
||||||
snippet = self.get_object()
|
snippet = self.get_object()
|
||||||
return Response(snippet.highlighted)
|
return Response(snippet.highlighted)
|
||||||
|
|
||||||
def pre_save(self, obj):
|
def perform_create(self, serializer):
|
||||||
obj.owner = self.request.user
|
serializer.save(owner=self.request.user)
|
||||||
|
|
||||||
This time we've used the `ModelViewSet` class in order to get the complete set of default read and write operations.
|
This time we've used the `ModelViewSet` class in order to get the complete set of default read and write operations.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user