Spaces:
Sleeping
Sleeping
Commit
·
f0f0086
1
Parent(s):
d875250
Vistas y rutas
Browse files- app/polls/urls.py +8 -1
- app/polls/views.py +13 -1
app/polls/urls.py
CHANGED
@@ -3,5 +3,12 @@ from django.urls import path
|
|
3 |
from . import views
|
4 |
|
5 |
urlpatterns = [
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
]
|
|
|
3 |
from . import views
|
4 |
|
5 |
urlpatterns = [
|
6 |
+
# ex: /polls/
|
7 |
+
path("", views.index, name="index"),
|
8 |
+
# ex: /polls/5/
|
9 |
+
path("<int:question_id>/", views.detail, name="detail"),
|
10 |
+
# ex: /polls/5/results/
|
11 |
+
path("<int:question_id>/results/", views.results, name="results"),
|
12 |
+
# ex: /polls/5/vote/
|
13 |
+
path("<int:question_id>/vote/", views.vote, name="vote"),
|
14 |
]
|
app/polls/views.py
CHANGED
@@ -2,4 +2,16 @@ from django.http import HttpResponse
|
|
2 |
|
3 |
|
4 |
def index(request):
|
5 |
-
return HttpResponse("Hello, world. You're at the polls index. Soy Aldo de ISC")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
|
4 |
def index(request):
|
5 |
+
return HttpResponse("Hello, world. You're at the polls index. Soy Aldo de ISC")
|
6 |
+
|
7 |
+
def detail(request, question_id):
|
8 |
+
return HttpResponse("You're looking at question %s." % question_id)
|
9 |
+
|
10 |
+
|
11 |
+
def results(request, question_id):
|
12 |
+
response = "You're looking at the results of question %s."
|
13 |
+
return HttpResponse(response % question_id)
|
14 |
+
|
15 |
+
|
16 |
+
def vote(request, question_id):
|
17 |
+
return HttpResponse("You're voting on question %s." % question_id)
|