Render wishes

This commit is contained in:
Jannis Portmann 2023-04-09 13:00:40 +02:00
parent 114a83e304
commit 821ad78dd6
2 changed files with 4 additions and 3 deletions

View file

@ -76,11 +76,11 @@
<p>{{ offer.user.username }} would like some of the following in return:</p>
<div class="mb-3">
{% if wishes %}
<div class="alert alert-warning" role="alert">There are currently no wishes!</div>
{% else %}
<ul class="list-group">
{% for wish in wishes %}<li class="list-group-item">{{ wish.title }}</li>{% endfor %}
</ul>
{% else %}
<div class="alert alert-warning" role="alert">There are currently no wishes!</div>
{% endif %}
</div>
<a class="btn btn-pfl mb-3" href="{% url 'offer_trade' offer.id %}">Offer trade</a>

View file

@ -38,8 +38,9 @@ def create_offer(request):
@ login_required
def offer_detail(request, offer_id):
offer = get_object_or_404(Offer, id=offer_id)
wishes = Wish.objects.filter(user=offer.user)
return render(request, "offer/detail.html", {"offer": offer, "wishes": ["Monstera", "Tradescantia"]})
return render(request, "offer/detail.html", {"offer": offer, "wishes": wishes})
@login_required