mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 13:00:12 +03:00
Update 1-serialization.md
Add status code 201 if serializer data is valid during PUT
This commit is contained in:
parent
944a1711ec
commit
c725a0461d
|
@ -283,7 +283,7 @@ We'll also need a view which corresponds to an individual snippet, and can be us
|
|||
serializer = SnippetSerializer(snippet, data=data)
|
||||
if serializer.is_valid():
|
||||
serializer.save()
|
||||
return JSONResponse(serializer.data)
|
||||
return JSONResponse(serializer.data, status=201)
|
||||
return JSONResponse(serializer.errors, status=400)
|
||||
|
||||
elif request.method == 'DELETE':
|
||||
|
|
Loading…
Reference in New Issue
Block a user