from django.conf.urls import url, include from tasks.views import TaskCreateView, TaskUpdateView, TaskDeleteView, \ TaskDetailView, TaskListView, TaskStatusUpdateView, CompletedTaskListView from nucleus.decorators import is_admin urlpatterns = [ url(r'^(?P<pk>\d+)/', include([ url(r'^edit/$', is_admin(TaskUpdateView.as_view()), name='edit_task'), url(r'^update_status/$', is_admin(TaskStatusUpdateView.as_view()), name='update_task_status'), url(r'^delete/$', is_admin(TaskDeleteView.as_view()), name='delete_task'), url(r'^$', is_admin(TaskDetailView.as_view()), name='view_task'), ])), url(r'^add/', is_admin(TaskCreateView.as_view()), name='add_task'), url(r'^completed/', is_admin(CompletedTaskListView.as_view()), name='browse_completed_tasks'), url(r'^$', is_admin(TaskListView.as_view()) , name='browse_tasks'), ]
(r'^post_questionnaire/(?P<task_pk>\d+)/$', 'post_questionnaire'), ) monitoring_patterns += named_urls( '', (r'^(?P<monitoring_pk>\d+)/claims/$', 'claims.views.claim_report'), (r'^(?P<monitoring_pk>\d+)/clarifications/$', 'clarifications.views.clarification_report'), ) tasks_patterns = named_urls( 'tasks.views', (r'^task/(?P<task_pk>\d+)_update/$', reversion.create_revision()( TaskEditView.as_view()), 'task_update'), (r'^task/(?P<task_pk>\d+)_delete/$', reversion.create_revision()( TaskDeleteView.as_view()), 'task_delete'), (r'^task/(?P<task_pk>\d+)_ajax_approve/$', AjaxTaskApproveView, 'ajax_task_approve'), (r'^task/(?P<task_pk>\d+)_ajax_close/$', AjaxTaskCloseView, 'ajax_task_close'), (r'^task/(?P<task_pk>\d+)_ajax_open/$', AjaxTaskOpenView, 'ajax_task_open'), (r'^taskexport/(?P<task_pk>\d+)/$', 'task_export'), (r'^taskimport/(?P<task_pk>\d+)/$', 'task_import'), ) tasks_patterns += named_urls( 'parameters.views', ( r'^task/(?P<task_pk>\d+)/parameter/add/$', ParamEditView,
https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 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, include from django.contrib import admin from django.contrib.auth import views as auth_views from tasks.views import TaskUpdateView, TaskDeleteView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', 'tasks.views.tasks_list', name='week_plan'), url(r'^start/', 'tasks.views.start', name='start'), url('^social/', include('social.apps.django_app.urls', namespace='social')), url(r'^users/logout/$', auth_views.logout, kwargs={'next_page': 'start'}, name='auth_logout'), # register users namespace url(r'^users/', include('registration.backends.simple.urls', namespace='users')), url(r'^add_task/', 'tasks.views.task_add', name='add_task'), url(r'^(?P<pk>\d+)/edit/$', TaskUpdateView.as_view(), name='edit_task'), url(r'^(?P<pk>\d+)/delete/$', TaskDeleteView.as_view(), name='delete_task'), ]
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 django.conf import settings from django.conf.urls.static import static from tasks.views import (TaskListView, TaskDetailsView, TaskUpdateView, TaskDeleteView, TaskCreateView) urlpatterns = [ path('admin/', admin.site.urls), path('tasklist/', TaskListView.as_view(), name='task-list'), path('tasklist/<int:taskl_id>/', TaskDetailsView.as_view(), name='task-detail'), path('tasklist/<int:taskl_id>/update/', TaskUpdateView.as_view(), name='task-update'), path('tasklist/<int:taskl_id>/delete/', TaskDeleteView.as_view(), name='task-delete'), path('tasklist/create/', TaskCreateView.as_view(), name='task-create'), ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.conf.urls import patterns, url from django.contrib.auth.decorators import login_required from tasks.views import (TaskCreateView, TaskDeleteView, TaskDoneView, TaskListView, TaskResetView) urlpatterns = patterns('', url(r'^$', login_required(TaskListView.as_view()), name='tasks'), url(r'^add/$', login_required(TaskCreateView.as_view()), name='task-create'), url(r'^(?P<uuid>[\w\d_.-]+)/reset/$', login_required(TaskResetView.as_view()), name='task-reset'), url(r'^(?P<uuid>[\w\d_.-]+)/done/$', login_required(TaskDoneView.as_view()), name='task-done'), url(r'^(?P<uuid>[\w\d_.-]+)/delete/$', login_required(TaskDeleteView.as_view()), name='task-delete'), )
monitoring_patterns += named_urls('questionnaire.views', (r'^(?P<monitoring_pk>\d+)/add_questionnaire/$', 'add_questionnaire'), (r'^(?P<monitoring_pk>\d+)/answers_export/$', 'answers_export', 'monitoring_answers_export'), (r'^post_questionnaire/(?P<task_pk>\d+)/$', 'post_questionnaire'), ) monitoring_patterns += named_urls('', (r'^(?P<monitoring_pk>\d+)/claims/$', 'claims.views.claim_report'), (r'^(?P<monitoring_pk>\d+)/clarifications/$', 'clarifications.views.clarification_report'), ) tasks_patterns = named_urls('tasks.views', (r'^task/(?P<task_pk>\d+)_update/$', reversion.create_revision()(TaskEditView.as_view()), 'task_update'), (r'^task/(?P<task_pk>\d+)_delete/$', reversion.create_revision()(TaskDeleteView.as_view()), 'task_delete'), (r'^task/(?P<task_pk>\d+)_ajax_approve/$', AjaxTaskApproveView, 'ajax_task_approve'), (r'^task/(?P<task_pk>\d+)_ajax_close/$', AjaxTaskCloseView, 'ajax_task_close'), (r'^task/(?P<task_pk>\d+)_ajax_open/$', AjaxTaskOpenView, 'ajax_task_open'), (r'^taskexport/(?P<task_pk>\d+)/$', 'task_export'), (r'^taskimport/(?P<task_pk>\d+)/$', 'task_import'), ) tasks_patterns += named_urls('parameters.views', (r'^task/(?P<task_pk>\d+)/parameter/add/$', ParamEditView, 'parameter_add',), (r'^task/(?P<task_pk>\d+)/parameter/(?P<parameter_pk>\d+)_update/$', ParamEditView, 'parameter_update'), (r'^task/(?P<task_pk>\d+)/parameter/(?P<parameter_pk>\d+)_delete/$', ParamDeleteView, 'parameter_delete'), ) auth_patterns = named_urls('exmo2010.custom_registration.views',