Answer the question
In order to leave comments, you need to log in
How to pass value on button click in Django?
Hello, I have this code:
<div class="container mb-5">
<div class="row">
{% for item in jumbo.section.articles.all %}
<div class="col-md-4">
<h2>{{ item.title }}</h2>
<a href="{% url 'item' %}?id={{ item.id }}">
<img src="{{ MEDIA_URL }}{{ item.image.url }}" width="180">
</a>
<form>
<input type="submit" class="btn btn-secondary" value="Добавить в корзину »">
</form>
</div>
{% endfor %}
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Hello. Alternatively, make the input hidden withvalue="{{item.id}}"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question