Exemple #1
0
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, include
from users import views as user_views
from quiz.views import homepage, QuestionListView, QuizListView, createQuestion, createQuiz, attemptquiz
from django.contrib.auth import views as auth_views #import in built authorization views


urlpatterns = [
    path('admin/', admin.site.urls, name='admin'),
    path('questions/', homepage, name='home'),
    path('addquestion/',createQuestion, name='create-question'),
    path('createquiz/',createQuiz, name='create-quiz'),
    #path('attemptquiz/<int:quiz_id>', attemptquiz, name='attempt-quiz'),
    path('', auth_views.LoginView.as_view(template_name='users/login.html'), name='login'),
    path('quiz/', QuizListView.as_view(), name='quizes'),    #All Quizes. 
    path('questions/<int:class_number>',QuestionListView.as_view(), name='questions'),      #All questions based on class 
    path('register/', user_views.register, name='register'),
    path('login/', auth_views.LoginView.as_view(template_name='users/login.html'), name='login'),
    path('logout/', auth_views.LogoutView.as_view(template_name='users/logout.html'), name='logout'),
    path('dashboard/',user_views.dashboard, name='user-dashboard'),  # Relevant user Dashboard
    path('profile/',user_views.profile, name='profile') #Profile - Link

]
Exemple #2
0
# urlpatterns = [
#     path('admin/', admin.site.urls),
# ]


# urlpatterns = [ 
#     url(r'^admin/', include(admin.site.urls)), 
#     url(r'', include('blog.urls')), 
# ]

urlpatterns = patterns('',
                        url(r'^media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}),
                        url(r'admin/', include(admin.site.urls)),
                        url(r'^/', include('quiz.urls')),
                       url(regex=r'^$',
                           view=QuizListView.as_view(),
                           name='quiz_index'),

                       url(regex=r'^category/$',
                           view=CategoriesListView.as_view(),
                           name='quiz_category_list_all'),

                       url(regex=r'^category/(?P<category_name>[\w|\W-]+)/$',
                           view=ViewQuizListByCategory.as_view(),
                           name='quiz_category_list_matching'),

                       url(regex=r'^progress/$',
                           view=QuizUserProgressView.as_view(),
                           name='quiz_progress'),

                       url(regex=r'^marking/$',
Exemple #3
0
from django.urls import path

from quiz.views import QuizListView

urlpatterns = [
    path('', QuizListView.as_view(), name='quiz_list'),
]
Exemple #4
0
from django.conf.urls import patterns, url

from quiz.views import QuizListView, CategoriesListView,\
    ViewQuizListByCategory, QuizUserProgressView, QuizMarkingList,\
    QuizMarkingDetail, QuizDetailView, QuizTake
from django.contrib.auth.decorators import login_required


urlpatterns = patterns('',

                       url(regex=r'^$',
                            view=QuizListView.as_view(),
#                            view=login_required(QuizListView.as_view()),
                           name='quiz_index'),

                       url(regex=r'^category/$',
                           view=CategoriesListView.as_view(),
                           name='quiz_category_list_all'),

                       url(regex=r'^category/(?P<category_name>[\w.-]+)/$',
                           view=ViewQuizListByCategory.as_view(),
                           name='quiz_category_list_matching'),

                       url(regex=r'^progress/$',
                           view=QuizUserProgressView.as_view(),
                           name='quiz_progress'),

                       url(regex=r'^marking/$',
                           view=QuizMarkingList.as_view(),
                           name='quiz_marking'),
Exemple #5
0
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from django.contrib.auth import views as auth_views
from django.conf.urls.i18n import i18n_patterns
from home import views
from quiz.views import QuizListView, QuizUserProgressView
from lesson.views import QuizView, register

quiz_urls = ([
    url(regex=r'^$',
        view=login_required(QuizListView.as_view()),
        name='quiz_index'),

    url(regex=r'^progress/$',
        view=login_required(QuizUserProgressView.as_view()),
        name='quiz_progress'),

    url(regex=r'^(?P<quiz_name>[\w-]+)/take/$',
        view=login_required(QuizView.as_view()),
        name='quiz_question'),
])

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
]
Exemple #6
0
from quiz.views import (StudentClassView, TeacherCabinetView, QuizListView,
                        QuizDetailView, IndexView, CreateQuizView,
                        AddQuestionsView, AddAnswersView, TakenQuizListView,
                        TakeQuiz, StudentPermissionDenied,
                        TeacherPermissionDenied)

app_name = 'quiz'

urlpatterns = [
    path('', IndexView.as_view(), name='index'),
    path('teacher/', TeacherCabinetView.as_view(), name='teacher_cabinet'),
    path('create_quiz', CreateQuizView.as_view(), name='create_quiz'),
    path('<int:pk>/add_questions',
         AddQuestionsView.as_view(),
         name='add_question'),
    path('<int:quiz_pk>/<int:question_pk>/add_answers',
         AddAnswersView.as_view(),
         name='add_answers'),
    path('student/', StudentClassView.as_view(), name='student_class'),
    path('list/', QuizListView.as_view(), name='quizzes_list'),
    path('quiz/<int:pk>', QuizDetailView.as_view(), name='quiz_detail'),
    path('taken_quiz', TakenQuizListView.as_view(), name='taken_quiz_list'),
    path('student/quiz/<int:pk>', TakeQuiz.as_view(), name='take_quiz'),
    path('teacher/permission-denied',
         TeacherPermissionDenied.as_view(),
         name='teacher_permission_denied'),
    path('student/permission-denied',
         StudentPermissionDenied.as_view(),
         name='student_permission_denied'),
]
Exemple #7
0
    ViewQuizListByCategory, QuizUserProgressView, QuizMarkingList, \
    QuizMarkingDetail, QuizDetailView, QuizTake
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf import settings
from django.conf.urls.static import static

try:
    from django.conf.urls import url
except ImportError:
    from django.urls import re_path as url

urlpatterns = [
    url('admin/', admin.site.urls),
    url(r'^registration/$', view=vi.registration, name='registration'),
    url(r'^login/$', view=vi.MyLoginView, name='login'),
    url(r'^$', view=QuizListView.as_view(), name='quiz_index'),
    url(r'^category/$',
        view=CategoriesListView.as_view(),
        name='quiz_category_list_all'),
    url(r'^category/(?P<category_name>[\w|\W-]+)/$',
        view=ViewQuizListByCategory.as_view(),
        name='quiz_category_list_matching'),
    url(r'^progress/$',
        view=QuizUserProgressView.as_view(),
        name='quiz_progress'),
    url(r'^marking/$', view=QuizMarkingList.as_view(), name='quiz_marking'),
    url(r'^marking/(?P<pk>[\d.]+)/$',
        view=QuizMarkingDetail.as_view(),
        name='quiz_marking_detail'),
    url(r'^(?P<slug>[-\w]+)/$',
        view=QuizDetailView.as_view(),
Exemple #8
0
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from home import views as home_views
from lists import views as list_views
#from lists.views import ListDetailView
from django.contrib.auth import views as auth_views
from auth_user import views as create_user_views
from quiz.views import QuizListView, QuestionListView, QuizCreateView, QuestionCreateView, QuizNameView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$',  auth_views.LoginView.as_view(template_name='auth_users/login.html'), name='login'),
    url(r'^logout',  auth_views.LogoutView.as_view(template_name='auth_users/logout.html'), name='logout'),
    url(r'^home', home_views.dashboard, name='home'),
    url(r'^user-list', list_views.user_lists, name='lists'),
    url(r'^list/(?P<pk>\d+)/', list_views.list_items, name='list_details'),
    url(r'^create-user', create_user_views.create_user, name='create-user'),
    url(r'^view-quiz', QuizListView.as_view(), name='view-quiz'),
    url(r'^create-quiz/(?P<pk>\d+)/', QuizCreateView.as_view(), name='create-quiz'),
    url(r'^name-quiz', QuizNameView.as_view(), name='name-quiz'),
    url(r'^list-questions/(?P<pk>\d+)/', QuestionListView.as_view(), name='list-questions'),
    url(r'^create-question/(?P<pk>\d+)/', QuestionCreateView.as_view(), name='create-question'),
]