from django.urls import path from quiz.views import IndexView, QuizView urlpatterns = [ path('', IndexView.as_view(), name='index'), path('quiz/', QuizView.as_view(), name='quiz'), ]
from django.urls import path from django.contrib.auth.decorators import login_required from quiz.views import ActiveQuizView, QuizView, QuestionView, QuizEndView, MyStatView urlpatterns = [ path('quiz/<int:quiz_id>/quiz_end', login_required(QuizEndView.as_view()), name='quiz_end'), path('quiz/<int:quiz_id>/<int:question_id>', login_required(QuestionView.as_view()), name='question_url'), path('quiz/<int:quiz_id>', login_required(QuizView.as_view()), name='quiz_url'), path('', login_required(ActiveQuizView.as_view()), name='active_quizzes'), path('stat', login_required(MyStatView.as_view()), name='my_static') ]
from quiz.views import QuizView, MRIQuizView, RestartView, IndexView, \ AnswerView, MRIAnswerView urlpatterns = [] if settings.DEBUG: urlpatterns += staticfiles_urlpatterns() urlpatterns += patterns('', url(r'^media/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT }) ) urlpatterns += patterns('', # Examples: # url(r'^$', 'mriquiz.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^quiz/(?P<quiz>[-\w]+)/$', QuizView.as_view(), name='quiz_view'), url(r'^quiz/(?P<quiz>[-\w]+)/restart/$', RestartView.as_view(), name="restart"), url(r'^mri-quiz/restart/$', RestartView.as_view(), {'quiz': 'mri'}, name="restart_mri"), url(r'^mri-quiz/$', MRIQuizView.as_view(), name="mri_quiz_view"), url(r'^answers/mri/$', MRIAnswerView.as_view(), name="mri_answer_view"), url(r'^answers/(?P<quiz>[-\w]+)/$', AnswerView.as_view(), name="quiz_answer_view"), url(r'^answers/$', IndexView.as_view(template_name="answers.html"), name="answer_overview"), url(r'^$', IndexView.as_view(), name="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 quiz.views import SearchView, QuizCreateView, QuizListView, QuizView, QuizResultView, QuestionCreateView urlpatterns = [ path('', SearchView.as_view()), path('create_quiz', QuizCreateView.as_view(), name='create_quiz'), path('create_question', QuestionCreateView.as_view(), name='create_question'), path('quiz', QuizListView.as_view(), name='quiz_list'), path('quiz/<slug:pk>', QuizView.as_view(template_name='quiz.html'), name='quiz'), path('quiz_old/<slug:pk>', QuizView.as_view(template_name='quiz_old.html'), name='quiz_old'), path('quiz_east/<slug:pk>', QuizView.as_view(template_name='quiz_east.html'), name='quiz_east'), path('quiz_result/<slug:pk>', QuizResultView.as_view(), name='quiz_result'), path('admin/', admin.site.urls), ]
from django.contrib import admin from django.urls import path from quiz.views import QuizView, HomeView, ProfileView, SearchView, \ add_comment, set_language, get_random_quiz from quiz.api import QuizDetailAPI from users.views import LoginView, LogoutView, RegisterView from editor.views import DashboardView, DeleteMapView, EditorView, NewView, \ delete_question, publish_quiz, remix_quiz, save_quiz_settings from score.api import ScoreAPI, me from text.views import render_page from wizard.views import wizard urlpatterns = [ path('admin/', admin.site.urls), path('quiz/<str:slug>/', QuizView.as_view(), name="quiz"), path('comments/<int:pk>/', add_comment, name="add-comment"), path('profile/<user>/', ProfileView.as_view(), name="profile"), path('search/', SearchView.as_view(), name="search"), path('users/login/', LoginView.as_view(), name="login"), path('users/logout/', LogoutView.as_view(), name="logout"), path('users/register/', RegisterView.as_view(), name="register"), path('dashboard/', DashboardView.as_view(), name="dashboard"), path('dashboard/delete/<int:pk>/', DeleteMapView.as_view(), name="delete-quiz"), path('dashboard/create/', NewView.as_view(), name="create-quiz"), path('dashboard/remix/<int:pk>/', remix_quiz, name="remix"), path('editor/<str:slug>/', EditorView.as_view(), name="editor"), path('editor/question/<int:pk>/', delete_question, name="delete-question"), path('editor/publish/<int:pk>/', publish_quiz, name="publish"),
from django.conf.urls import url from django.contrib.auth.decorators import login_required from quiz.views import QuizResultView, QuizView, QuestionView urlpatterns = [ url(r'^result/(?P<pk>\d+)/$', login_required(QuizResultView.as_view()), name='result'), url(r'^(?P<pk>\d+)/$', login_required(QuizView.as_view()), name='quiz'), url(r'^(?P<quiz_id>\d+)/question/(?P<question_num>\d+)/$', login_required(QuestionView.as_view()), name='question'), ]
The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 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 quiz.views import SearchView, QuizCreateView, QuizView, QuizResultView, QuestionCreateView urlpatterns = [ path('', SearchView.as_view()), path('create_quiz', QuizCreateView.as_view(), name='create_quiz'), path('create_question', QuestionCreateView.as_view(), name='create_question'), path('quiz/<slug:pk>', QuizView.as_view(), name='quiz'), path('quiz_result/<slug:pk>', QuizResultView.as_view(), name='quiz_result'), path('admin/', admin.site.urls), ]
from django.urls import path from django.conf.urls import url from . import views from quiz.views import HomeView, QuizView, ProgressView app_name = 'quiz' ########## URls to the three HTML templates and what Views they use ########## urlpatterns = [ #When use is directed to a page, the page id is passed to and from the view and the template through the URL. path('quiz/<int:page_id>/', QuizView.as_view(), name='quiz'), path('quiz/', QuizView.as_view(), name='quiz_post'), path('', HomeView.as_view(), name='index'), path('progress/', ProgressView.as_view(), name='progress'), ]