Skip to content

Commit

Permalink
Update views.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekaterina-Vititneva committed Aug 13, 2024
1 parent 432b15c commit bc535f0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions project_2/commerce/auctions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ def listing(request, title):
return handle_comment(request, listing)
elif 'close_listing' in request.POST:
return handle_close_listing(request, listing)
elif 'add_to_watchlist' in request.POST:
user.watchlist.add(listing)
messages.success(request, "Listing added to your watchlist.")
elif 'remove_from_watchlist' in request.POST:
user.watchlist.remove(listing)
messages.success(request, "Listing removed from your watchlist.")

comments = listing.comments.all()

Expand All @@ -113,6 +119,7 @@ def listing(request, title):
"comments": comments,
})



def handle_bid(request, listing):
form = BidForm(request.POST)
Expand Down

0 comments on commit bc535f0

Please sign in to comment.