mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-11 04:07:39 +03:00
Merge pull request #3841 from linovia/feature/3776
Fix update model example in html-and-forms.md
This commit is contained in:
commit
50749c4730
|
@ -66,9 +66,10 @@ The following view demonstrates an example of using a serializer in a template f
|
|||
|
||||
def post(self, request, pk):
|
||||
profile = get_object_or_404(Profile, pk=pk)
|
||||
serializer = ProfileSerializer(profile)
|
||||
serializer = ProfileSerializer(profile, data=request.data)
|
||||
if not serializer.is_valid():
|
||||
return Response({'serializer': serializer, 'profile': profile})
|
||||
serializer.save()
|
||||
return redirect('profile-list')
|
||||
|
||||
**profile_detail.html**:
|
||||
|
|
Loading…
Reference in New Issue
Block a user