Skip to content

Commit

Permalink
Tags for listing statuse, updated bootstrap version
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekaterina-Vititneva committed Aug 10, 2024
1 parent 5df0ed5 commit 2c65c66
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion project_2/commerce/auctions/templates/auctions/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<html lang="en">
<head>
<title>{% block title %}Auctions{% endblock %}</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<link href="{% static 'auctions/styles.css' %}" rel="stylesheet">
</head>
<body>
Expand Down
4 changes: 2 additions & 2 deletions project_2/commerce/auctions/templates/auctions/listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ <h4 class="listing-bid">{{ listing.bid }}€</h4>
<div>Updated time: {{ listing.updated_at }}</div>
<div>Statuse:
{%if listing.active%}
Active
<span class="badge text-bg-success">Active</span>
{% else %}
Closed
<span class="badge text-bg-danger">Closed</span>
{% endif %}
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions project_2/commerce/auctions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


def index(request):
active_listings = Listing.objects.all()
active_listings = Listing.objects.filter(active=True)
return render(request, "auctions/index.html", {
"listings": active_listings
})
Expand Down Expand Up @@ -132,7 +132,7 @@ def listing(request, title):
if listing.active:
listing.active = False
listing.save()
messages.success(request, "Your listing was deleted successfully!")
messages.success(request, "Your listing was closed successfully!")
return redirect('listing', title=listing.title)

else:
Expand Down

0 comments on commit 2c65c66

Please sign in to comment.