fef-questionnaire/questionnaire/urls.py

56 lines
2.0 KiB
Python
Raw Permalink Normal View History

# vim: set fileencoding=utf-8
from django.conf.urls import *
from django.conf import settings
2016-07-26 21:08:23 +00:00
from .views import *
from .page.views import page, langpage
2016-11-03 15:43:08 +00:00
urlpatterns = [
url(r'^$',
questionnaire, name='questionnaire_noargs'),
url(r'^csv/(?P<qid>\d+)/$',
export_csv, name='export_csv'),
2017-06-08 21:28:18 +00:00
url(r'^summary/(?P<qid>\d+)/$',
export_summary, name='export_summary'),
url(r'^(?P<runcode>[^/]+)/progress/$',
get_async_progress, name='progress'),
2016-07-26 21:08:23 +00:00
url(r'^take/(?P<questionnaire_id>[0-9]+)/$', generate_run),
url(r'^$', page, {'page_to_render' : 'index'}),
url(r'^(?P<page_to_render>.*)\.html$', page),
url(r'^(?P<lang>..)/(?P<page_to_trans>.*)\.html$', langpage),
url(r'^setlang/$', set_language),
url(r'^landing/(?P<nonce>\w+)/$', QuestionnaireView.as_view(), name="landing"),
2016-11-03 15:43:08 +00:00
]
# item questionnaires
try:
if settings.QUESTIONNAIRE_ITEM_MODEL and settings.QUESTIONNAIRE_SHOW_ITEM_RESULTS:
urlpatterns += [
url(r"^items/$", questionnaires, name="questionnaires"),
url(r"^new_questionnaire/(?P<item_id>\d*)/?$", new_questionnaire, name="new_questionnaire"),
url(r"^items/answers_(?P<qid>\d+)_(?P<item_id>\d*).csv$", export_item_csv, name="questionnaire_answers"),
url(r"^items/summary_(?P<qid>\d+)_(?P<item_id>\d*).csv$", export_item_summary, name="answer_summary"),
]
except AttributeError:
pass
urlpatterns += [url(r'^(?P<runcode>[^/]+)/(?P<qs>[-]{0,1}\d+)/$', questionnaire, name='questionset')]
if not use_session:
2016-11-03 15:43:08 +00:00
urlpatterns += [
url(r'^(?P<runcode>[^/]+)/$',
questionnaire, name='questionnaire'),
url(r'^(?P<runcode>[^/]+)/(?P<qs>[-]{0,1}\d+)/prev/$',
redirect_to_prev_questionnaire,
name='redirect_to_prev_questionnaire'),
2016-11-03 15:43:08 +00:00
]
else:
2016-11-03 15:43:08 +00:00
urlpatterns += [
url(r'^$',
questionnaire, name='questionnaire'),
url(r'^prev/$',
redirect_to_prev_questionnaire,
name='redirect_to_prev_questionnaire')
2016-11-03 15:43:08 +00:00
]