from django.contrib import admin from django.urls import path from webapp.views import PollListView, PollDetailView, PollCreateView, PollUpdateView, PollDeleteView, ChoiceUpdateView, \ ChoiceDeleteView, ChoiceCreateView,CreateAnswerView, PollStatistics urlpatterns = [ path('admin/', admin.site.urls), path('', PollListView.as_view(), name='index'), path('poll/<int:pk>', PollDetailView.as_view(), name='view_poll'), path('poll/create/', PollCreateView.as_view(), name='create_poll'), path('poll/update/<int:pk>', PollUpdateView.as_view(), name='update_poll'), path('poll/delete/<int:pk>', PollDeleteView.as_view(), name='delete_poll'), path('choice/update/<int:pk>', ChoiceUpdateView.as_view(), name='update_choice'), path('choice/delete/<int:pk>', ChoiceDeleteView.as_view(), name='delete_choice'), path('choice/create/<int:pk>', ChoiceCreateView.as_view(), name='create_choice'), path('answer/<int:pk>', CreateAnswerView.as_view(), name='create_answer'), path('stats/<int:pk>', PollStatistics.as_view(), name='poll_stats') ]
1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from webapp.views import IndexView, PollUpdateView, PollCreateView, PollView, PollDeleteView, ChoiceForPollCreateView, \ ChoiceUpdateView,ChoiceDeleteView,AnswerView urlpatterns = [ path('admin/', admin.site.urls), path('', IndexView.as_view(), name='index'), path('poll/<int:pk>', PollView.as_view(), name='poll_view'), path('create/poll', PollCreateView.as_view(), name='poll_create'), path('update/poll/<int:pk>', PollUpdateView.as_view(), name='poll_update'), path('delete/poll/<int:pk>', PollDeleteView.as_view(), name='poll_delete'), path('create/choice/<int:pk>', ChoiceForPollCreateView.as_view(), name='poll_choice_create'), path('update/choice/<int:pk>', ChoiceUpdateView.as_view(), name='choice_update'), path('delete/choice/<int:pk>', ChoiceDeleteView.as_view(), name='choice_delete'), path('poll/<int:pk>/answer/', AnswerView.as_view(), name='answer') ]
1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from webapp.views import IndexView, PollView, PollCreateView, PollUpdateView, \ PollDeleteView, ChoiceView, ChoiceCreateView, ChoiceUpdateView, ChoiceDeleteView, ChoiceDetailView, AnswerView urlpatterns = [ path('admin/', admin.site.urls), path('', IndexView.as_view(), name='index'), path('poll/<int:pk>/', PollView.as_view(), name='poll_view'), path('poll/add/', PollCreateView.as_view(), name='poll_add'), path('poll/<int:pk>/update/', PollUpdateView.as_view(), name='poll_update'), path('poll/<int:pk>/delete/', PollDeleteView.as_view(), name='poll_delete'), path('choice/', ChoiceView.as_view(), name='choices_view'), path('choice/<int:pk>/', ChoiceDetailView.as_view(), name='choice_view'), path('choice/add/', ChoiceCreateView.as_view(), name='choice_add'), path('choice/<int:pk>/update/', ChoiceUpdateView.as_view(), name='choice_update'), path('choice/<int:pk>/delete/', ChoiceDeleteView.as_view(), name='choice_delete'), path('poll/<int:pk>/answers/', AnswerView.as_view(), name='answers_view'), ]
2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from webapp.views import IndexView, PollView, PollCreateView, PollUpdateView, PollDeleteView, ChoiseForPullCreateView, \ ChoiseUpdateView, ChoiseDeleteView from webapp.views.answer_views import AnswerIndexView from webapp.views.poll_views import PollAnswerView urlpatterns = [ path('admin/', admin.site.urls), path('', IndexView.as_view(), name='index'), path('poll/<int:pk>/', PollView.as_view(), name='poll_view'), path('poll/create/', PollCreateView.as_view(), name='poll_create'), path('poll/<int:pk>/edit/', PollUpdateView.as_view(), name='poll_update'), path('poll/<int:pk>/delete/', PollDeleteView.as_view(), name='poll_delete'), path('poll/<int:pk>/add-choise/', ChoiseForPullCreateView.as_view(), name='poll_choise_create'), path('choise/<int:pk>/edit/', ChoiseUpdateView.as_view(), name='choise_update'), path('choise/<int:pk>/delete/', ChoiseDeleteView.as_view(), name='choise_delete'), path('poll/<int:pk>/answer', PollAnswerView.as_view(), name='poll_answer'), path('answers/', AnswerIndexView.as_view(), name='answer_index'),\ ]