new templates

This commit is contained in:
Basyrov Rustam
2025-06-04 18:52:49 +03:00
parent 3e45e0bb6f
commit e4d1a44cd8
2 changed files with 21 additions and 6 deletions

View File

@@ -1,6 +1,12 @@
<h1>{{ question.question_text }}</h1>
<ul>
<form action="{% url 'polls:vote' question.id %}" method="post">
{% csrf_token %}
<fieldset>
<legend><h1>{{ question.question_text }}</h1></legend>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
{% for choice in question.choice_set.all %}
<li>{{ choice.choice_text }}</li>
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}">
<label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br>
{% endfor %}
</ul>
</fieldset>
<input type="submit" value="Vote">
</form>

View File

@@ -0,0 +1,9 @@
<h1>{{ question.question_text }}</h1>
<ul>
{% for choice in question.choice_set.all %}
<li>{{ choice.choice_text }} -- {{ choice.votes }} vote{{ choice.votes|pluralize }}</li>
{% endfor %}
</ul>
<a href="{% url 'polls:detail' question.id %}">Vote again?</a>