Fix update model example in html-and-forms.md

This commit is contained in:
Leonid Shvechikov 2015-12-27 17:14:33 +03:00
parent 2d27d9a10a
commit ff0292a757

View File

@ -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.POST)
if not serializer.is_valid():
return Response({'serializer': serializer, 'profile': profile})
serializer.save()
return redirect('profile-list')
**profile_detail.html**: