close listing fixes

This commit is contained in:
Priyatham-sai-chand 2020-10-27 15:29:37 +05:30
parent 141491e9dc
commit 42602ff2c7
3 changed files with 72 additions and 72 deletions

View File

@ -1,72 +1,72 @@
{% extends "auctions/layout.html" %}
{% block body %}
<h2>Active Listings</h2>
{% if Listings %}
<div class="row">
{% for listing in Listings %}
{% if not listing.closed %}
<div class="col md-3 mb-4">
<a href="listing/{{ listing.title}}" style = "color:inherit;text-decoration: none;">
<div class="card border-light" style="width: 18rem;">
<div class="shadow p-2 mb-2 bg-white rounded">
<img class="card-img-top" src="{{ listing.picture }}" alt="Preview not found">
<hr>
<div class="card-body">
<h4>{{ listing.title }}</h4><br>
<p class="card-text" style="font-size: medium;">
{% for bidding in listing.bidding_listing.all %}
<b>bid price</b> : <strong style="color:darkgreen;">${{bidding.bid_value}}</strong><br>
<b>Last bid by</b>: <strong style="color:navy;">{{ bidding.user }}</strong>
<br>
<b>Description</b>: {{ listing.desc }}<br>
{% endfor %}
<small class="text-muted"><i> created on {{listing.date_added}}</i> </small>
</p>
<div class = "text-right">
{% if user.is_authenticated %}
<form action="{% url 'watch' listing.title %}" method="POST">
{% csrf_token %}
{% if user not in listing.watchlists.all %}
<button type="submit" name="watch", value="{{user}}", class="btn btn-primary btn-sm">Watch</button>
{% else %}
<button type="submit" name="watch", value="{{user}}", class="btn btn-secondary btn-sm">Unwatch</button>
{% endif %}
<input type="hidden" name="previous" value="{{ request.path }}">
</form>
{% else %}
<small>log in to watch this listing</small>
{% endif %}
</div>
</div>
</div>
</div>
</a>
</div>
{% endif %}
{% endfor %}
</div>
{% else %}
<br/>
<br/>
<br/>
<center>
<h3> Seems to be no listings in this Auction!!</h3>
</center>
{% endif %}
{% extends "auctions/layout.html" %}
{% block body %}
<h2>Active Listings</h2>
{% if Listings %}
<div class="row">
{% for listing in Listings %}
{% if not listing.closed %}
<div class="col md-3 mb-4">
<a href="listing/{{ listing.title}}" style = "color:inherit;text-decoration: none;">
<div class="card border-light" style="width: 18rem;">
<div class="shadow p-2 mb-2 bg-white rounded">
<img class="card-img-top" src="{{ listing.picture }}" alt="Preview not found">
<hr>
<div class="card-body">
<h4>{{ listing.title }}</h4><br>
<p class="card-text" style="font-size: medium;">
{% for bidding in listing.bidding_listing.all %}
<b>bid price</b> : <strong style="color:darkgreen;">${{bidding.bid_value}}</strong><br>
<b>Last bid by</b>: <strong style="color:navy;">{{ bidding.user }}</strong>
<br>
<b>Description</b>: {{ listing.desc }}<br>
{% endfor %}
<small class="text-muted"><i> created on {{listing.date_added}}</i> </small>
</p>
<div class = "text-right">
{% if user.is_authenticated %}
<form action="{% url 'watch' listing.title %}" method="POST">
{% csrf_token %}
{% if user not in listing.watchlists.all %}
<button type="submit" name="watch", value="{{user}}", class="btn btn-primary btn-sm">Watch</button>
{% else %}
<button type="submit" name="watch", value="{{user}}", class="btn btn-secondary btn-sm">Unwatch</button>
{% endif %}
<input type="hidden" name="previous" value="{{ request.path }}">
</form>
{% else %}
<small>log in to watch this listing</small>
{% endif %}
</div>
</div>
</div>
</div>
</a>
</div>
{% endif %}
{% endfor %}
</div>
{% else %}
<br/>
<br/>
<br/>
<center>
<h3> Seems to be no listings in this Auction!!</h3>
</center>
{% endif %}
{% endblock %}

View File

@ -5,7 +5,7 @@
<h2>Listing : {{ Listing.title}}</h2>
<div class="text-right">
{% if user.username|stringformat:"s" == Listing.user|stringformat:"s" %}
{% if user.username|stringformat:"s" == Listing.user|stringformat:"s" and not Listing.closed %}
<a class="btn btn-danger" href="{% url 'close_bid' Listing.title %}" role="button" style="display:inline;">Close this Listing</a>
{% endif %}

Binary file not shown.