58 lines
2.1 KiB
HTML
58 lines
2.1 KiB
HTML
{% extends "auctions/layout.html"%}
|
|
|
|
{% block body %}
|
|
<h2>Listings under category "{{ cat_name }}"</h2>
|
|
{% if listings %}
|
|
<div class="row">
|
|
|
|
{% for list in listings %}
|
|
<div class="col-sm-3">
|
|
<a href="{% url 'listing' {{list.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="{{ list.picture }}" alt="Preview not found">
|
|
|
|
<hr>
|
|
<div class="card-body">
|
|
<h4>{{ list.title }}</h4><br>
|
|
|
|
|
|
<p class="card-text" style="font-size: large;">
|
|
<b>bid price</b> : ${{list.price}}<br>
|
|
<b>created by</b>: {{list.user}}
|
|
</p>
|
|
<div class = "text-right">
|
|
|
|
{% if user.is_authenticated %}
|
|
<form action="{% url 'watchlist' list.title %}" method="POST">
|
|
{% csrf_token %}
|
|
{% if user not in list.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-primary btn-sm">Unwatch</button>
|
|
{% endif %}
|
|
</form>
|
|
{% else %}
|
|
<small>log in to watch this listing</small>
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% else %}
|
|
<br/>
|
|
<br/>
|
|
<br/>
|
|
<center>
|
|
<h3> Seems to be no listings in this category</h3>
|
|
</center>
|
|
{% endif %}
|
|
{% endblock %} |