move functions to class

Used generic views
This commit is contained in:
Basyrov Rustam
2025-06-04 18:53:17 +03:00
parent 6906819c3a
commit ebf90a591b
2 changed files with 47 additions and 11 deletions

View File

@@ -4,11 +4,8 @@ from . import views
app_name = "polls"
urlpatterns = [
path("", views.index, name="index"),
# example: /polls/5/
path("<int:question_id>/", views.detail, name="detail"),
# example: /polls/5/results/
path("<int:question_id>/results/", views.results, name="results"),
# example: /polls/5/vote/
path("", views.IndexView.as_view(), name="index"),
path("<int:pk>/", views.DetailView.as_view(), name="detail"),
path("<int:pk>/results/", views.ResultsView.as_view(), name="results"),
path("<int:question_id>/vote/", views.vote, name="vote"),
]