Skip to content

Commit

Permalink
fix: fix problem with django not finding bid update endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
sandronadiradze committed Nov 2, 2024
1 parent 9be4549 commit d68f868
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions bid/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@

urlpatterns = [
path(
"auction/<uuid:auction_id>/bid/create/",
"create/bid/<uuid:auction_id>/",
CreateBidView.as_view(),
name="create-bid",
),
path(
"update/<uuid:bid_id>/",
"update/bid/<uuid:bid_id>/",
UpdateBidView.as_view(),
name="update-bid",
),
path("auction/bid/<uuid:bid_id>/", RetrieveBidView.as_view(), name="retrieve-bid"),
path("bids/<uuid:bid_id>/reject/", RejectBidView.as_view(), name="reject-bid"),
path("bids/<uuid:bid_id>/approve/", ApproveBidView.as_view(), name="approve-bid"),
path("retrieve/bid/<uuid:bid_id>/", RetrieveBidView.as_view(), name="retrieve-bid"),
path("reject/bid/<uuid:bid_id>/", RejectBidView.as_view(), name="reject-bid"),
path("approve/bid/<uuid:bid_id>/", ApproveBidView.as_view(), name="approve-bid"),
path(
"bids/list/buyer/",
BuyerBidListView.as_view(),
Expand Down
7 changes: 6 additions & 1 deletion bid/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,14 @@ class UpdateBidView(generics.UpdateAPIView):
serializer_class = UpdateBidSerializer
permission_classes = [IsAuthenticated, IsBidOwner]
lookup_url_kwarg = "bid_id"
queryset = Bid.objects.all()
http_method_names = ["patch"]

def get_queryset(self):
"""
Get base queryset with all necessary related fields.
"""
return Bid.objects.select_related("auction").prefetch_related("images")

def perform_update(self, serializer):
"""Send WebSocket notification after bid update"""
bid = serializer.save()
Expand Down

0 comments on commit d68f868

Please sign in to comment.