tangled
alpha
login
or
join now
baileykane.co
/
django-hello-world
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
Change question detail screen to a form
baileykane.co
6 months ago
3773e1de
13a14446
+19
-6
1 changed file
expand all
collapse all
unified
split
polls
templates
polls
detail.html
+19
-6
polls/templates/polls/detail.html
···
1
1
-
<h1>{{ question.question_text }}</h1>
2
2
-
<ul>
3
3
-
{% for choice in question.choice_set.all %}
4
4
-
<li>{{ choice.choice_text }}</li>
5
5
-
{% endfor %}
6
6
-
</ul>
1
1
+
<form action="{% url 'polls:vote' question.id%}" method="post">
2
2
+
{% csrf_token%}
3
3
+
<fieldset>
4
4
+
<legend><h1>{{ question.question_text }}</h1></legend>
5
5
+
{% if error_message%}
6
6
+
<p><strong>{{ error_message }}</strong></p>
7
7
+
{% endif%} {% for choice in question.choice_set.all %}
8
8
+
<input
9
9
+
type="radio"
10
10
+
name="choice"
11
11
+
id="choice{{ forloop.counter }}"
12
12
+
value="{{ choice.id }}"
13
13
+
/>
14
14
+
<label for="choice{{ forloop.counter }}">{{choice.choice_text}}</label
15
15
+
><br />
16
16
+
{% endfor %}
17
17
+
</fieldset>
18
18
+
<input type="submit" value="Vote" />
19
19
+
</form>