这是index.html
{% extends 'base.html' %}
{% block content %}
list of {{title}}
{% if questions %}
{% for question in questions %}
{% endfor %}
{% else %}
there is a no question available
{% endif %}
{% endblock %}
details.html
{% extends 'base.html' %}
{% block content %}
Details Page
{{question.title}}
{% for choice in question.choices %}
{{choice.text}}({{choice.votes}})
{% empty %}
There is no choice available for this Question
{% endfor %}
Poll is created by {{question.created_by.first_name}}
{% endblock %}
这是base.html
{%load static%}
WebPageWelcome to My Page
{% block content %}
{% endblock %}
还有poll.urls
from django.conf.urls import url
from poll.views import *
urlpatterns = [
url('', index, name='polls_list'),
url('/details/', details, name='polls_details')
]
所以这就是发生的事情,我在index.html上显示了3个问题,单击它们中的任何一个,它将更改为正确的url,但没有打开请求的页面。我该如何解决。请记住,我两天前才刚开始django,所以请原谅我的天真。