Skip to content

Commit

Permalink
Merge pull request #182 from rkshaon/181-book-add-api-error-500
Browse files Browse the repository at this point in the history
fixed: #181 - book upload error
  • Loading branch information
rkshaon authored Nov 30, 2024
2 parents 5e0aa13 + 28bf087 commit 47d04a5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions backend/book_api/views/v1/book.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ def get(self, request, *args, **kwargs):
def post(self, request, *args, **kwargs):
self.permission_classes = [IsAdminOrModerator]
self.check_permissions(request)
requested_data = request.data.copy()
requested_data['added_by'] = request.user.id
print(f"\nrequested_data: {requested_data}\n")
request.data['added_by'] = request.user.id
serializer = BookSerializer(
data=requested_data,
data=request.data,
)
serializer.is_valid(raise_exception=True)
serializer.save()
Expand Down

0 comments on commit 47d04a5

Please sign in to comment.