add views
This commit is contained in:
parent
2d050c10f4
commit
2b54e70f1b
@ -4,4 +4,12 @@ from . import views
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.index, name='index'),
|
path('', views.index, name='index'),
|
||||||
|
# ex: /polls/
|
||||||
|
path('', views.index, name='index'),
|
||||||
|
# ex: /polls/5/
|
||||||
|
path('<int:question_id>/', views.detail, name='detail'),
|
||||||
|
# ex: /polls/5/results/
|
||||||
|
path('<int:question_id>/results/', views.results, name='results'),
|
||||||
|
# ex: /polls/5/vote/
|
||||||
|
path('<int:question_id>/vote/', views.vote, name='vote'),
|
||||||
]
|
]
|
@ -5,4 +5,14 @@ from django.http import HttpResponse
|
|||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
return HttpResponse("Hello, world. You're at the polls index.")
|
return HttpResponse("Hello, world. You're at the polls index.")
|
||||||
|
|
||||||
|
def detail(request, question_id):
|
||||||
|
return HttpResponse("You're looking at question %s." % question_id)
|
||||||
|
|
||||||
|
def results(request, question_id):
|
||||||
|
response = "You're looking at the results of question %s."
|
||||||
|
return HttpResponse(response % question_id)
|
||||||
|
|
||||||
|
def vote(request, question_id):
|
||||||
|
return HttpResponse("You're voting on question %s." % question_id)
|
Loading…
Reference in New Issue
Block a user