Spaces:
Sleeping
Sleeping
Commit
·
aea2ee8
1
Parent(s):
e261990
templates created
Browse files
app/polls/templates/polls/index.html
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% if latest_question_list %}
|
2 |
+
<ul>
|
3 |
+
{% for question in latest_question_list %}
|
4 |
+
<li><a href="/polls/{{ question.id }}/">{{ question.question_text }}</a></li>
|
5 |
+
{% endfor %}
|
6 |
+
</ul>
|
7 |
+
{% else %}
|
8 |
+
<p>No polls are available.</p>
|
9 |
+
{% endif %}
|
app/polls/views.py
CHANGED
@@ -2,7 +2,6 @@ from django.http import HttpResponse
|
|
2 |
|
3 |
from .models import Question
|
4 |
|
5 |
-
|
6 |
def index(request):
|
7 |
latest_question_list = Question.objects.order_by('-pub_date')[:5]
|
8 |
output = ', '.join([q.question_text for q in latest_question_list])
|
|
|
2 |
|
3 |
from .models import Question
|
4 |
|
|
|
5 |
def index(request):
|
6 |
latest_question_list = Question.objects.order_by('-pub_date')[:5]
|
7 |
output = ', '.join([q.question_text for q in latest_question_list])
|