Skip to content

Instantly share code, notes, and snippets.

@esirK
Created October 25, 2018 08:06
Show Gist options
  • Save esirK/94ad9f67acc7e7462036485bb4322a3e to your computer and use it in GitHub Desktop.
Save esirK/94ad9f67acc7e7462036485bb4322a3e to your computer and use it in GitHub Desktop.
def put(self, request, pk):
saved_article = get_object_or_404(Article.objects.all(), pk=pk)
data = request.data.get('article')
serializer = ArticleSerializer(instance=saved_article, data=data, partial=True
if serializer.is_valid(raise_exception=True):
article_saved = serializer.save()
return Response({"success": "Article '{}' updated successfully".format(article_saved.title)})
@mhd-riaz
Copy link

seems like you missed to close parenthesis on line 4

@esirK
Copy link
Author

esirK commented Sep 10, 2021

seems like you missed to close parenthesis on line 4

Thanks for the catch @racyriaz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment