Ejemplo n.º 1
0
from django.conf.urls import url
from django.contrib import admin
from task.views import home, logout_view , TaskUpdate, TaskDelete, TaskCreate, TaskListView
from task import views
from task.models import task

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', home),
    url(r'^home/', home),
    url(r'^logout/', logout_view),
    url(r'^task_list/(?P<filter_param>\w+)/$', TaskListView.as_view(model = task), name='task_list'),
    url(r'^add_task/$', TaskCreate.as_view(model=task,success_url='/task_list/all' ), name='add_task'),
    url(r'^delete_task/(?P<pk>\d+)/$', TaskDelete.as_view(model=task,success_url='/task_list/all' ), name='delete_task'),
    url(r'^edit_task/(?P<pk>\d+)/$', TaskUpdate.as_view(model=task,success_url='/task_list/all' ), name='edit_task'),
    url(r'^update_status/(?P<status>\w+)/(?P<pk>\d+)/$', views.update_status, name ='update_status'),


]
Ejemplo n.º 2
0
"""tasks URL Configuration

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 task.views import TaskListView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('',TaskListView.as_view()),
]
Ejemplo n.º 3
0
    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.contrib.auth.views import LogoutView
from django.views.generic.base import RedirectView
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from task.views import TaskListView, TaskCreateOrUpdateView, TaskDetailView, TaskDeleteView
from accounts.views import UserRegistrationView, UserLoginView
from back_end import settings

urlpatterns = [
    path('admin/', admin.site.urls),

    # as_view() 初始化view class,返回句柄
    path('', RedirectView.as_view(url='task/')),
    path('task/', TaskListView.as_view()),
    path('task/create/', TaskCreateOrUpdateView.as_view()),
    path('task/<task_id>/', TaskDetailView.as_view()),
    path('task/<task_id>/update/', TaskCreateOrUpdateView.as_view()),
    path('task/<pk>/delete/', TaskDeleteView.as_view()),
    path('user/create/', UserRegistrationView.as_view()),
    path('user/login/', UserLoginView.as_view()),
    path('user/logout/', LogoutView.as_view())
]
if settings.DEBUG:
    urlpatterns += staticfiles_urlpatterns()
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
Ejemplo n.º 4
0
"""tasks URL Configuration

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 task.views import TaskListView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', TaskListView.as_view())
]
Ejemplo n.º 5
0
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.conf.urls.static import static
from django.conf import settings
from task.views import TaskListView
from django.contrib.auth.decorators import login_required


urlpatterns = [
    url(r'^$', login_required(TaskListView.as_view()), name="index"),
    url(r'^admin/', admin.site.urls),
    url(r'^task/', include('task.urls', namespace='task')),
    url(r'^api/task/', include('task.api.urls', namespace='task_api')),
    url(r'^accounts/', include('accounts.urls', namespace='accounts')),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Ejemplo n.º 6
0
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 django.contrib.auth.views import LoginView, LogoutView

from task.views import TaskListView, TaskDetailView, TaskCreateView, TaskUpdateView, TaskDeleteView

urlpatterns = [
    path('login/', LoginView.as_view(template_name='login.html'),
         name='login'),
    path('logout/',
         LogoutView.as_view(template_name='logout.html'),
         name='logout'),
    path('delete/<int:pk>', TaskDeleteView.as_view(), name="delete"),
    path('update/<int:pk>', TaskUpdateView.as_view(), name="update"),
    path('create', TaskCreateView.as_view(), name="create"),
    path('detail/<int:pk>', TaskDetailView.as_view(), name="detail"),
    path('', TaskListView.as_view(), name="index"),
    path('admin/', admin.site.urls),
]
Ejemplo n.º 7
0
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, include
from rest_framework.documentation import include_docs_urls
from rest_framework.routers import DefaultRouter

from task.views import TaskListView, TaskViewSet
from rest_framework.authtoken import views

router = DefaultRouter()
router.register('tasks', TaskViewSet)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api-auth/', include('rest_framework.urls')),
    path('docs/', include_docs_urls(title='Task API')),
    path('login/', views.obtain_auth_token),
    path('api/', include(router.urls)),
    path('task/', TaskListView.as_view())
]
Ejemplo n.º 8
0
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. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import include, url
from django.contrib import admin, auth
from task.views import TaskListView
from django.contrib.auth import views as auth_views
from .views import user_login, user_logout, user_register
# urlpatterns = [
#     url('^auth/', include('django.contrib.auth.urls')),
# ]
#
# urlpatterns += [
#     # url(r'^admin/', include(admin.site.urls)),
#     url(r'^$', auth_views.login),
#     url(r'^register/$', user_register),
#     url(r'^accounts/$', include(admin.site.urls)),
#     url(r'^task/', TaskListView.as_view()),
# ]

urlpatters = [
    url(r'^login/$', user_login),
    url(r'^logout/$', user_logout),
    url(r'^tasks/$', TaskListView.as_view()),
]
Ejemplo n.º 9
0
from django.conf.urls import patterns, include, url
from django.contrib.auth.forms import AuthenticationForm

from django.contrib import admin
admin.autodiscover()

# from task.views import HomeView
# from task.models import Task
from task.views import TaskListView, TaskDelete
from task import views

urlpatterns = patterns(
    '',
    url(r'^$', TaskListView.as_view(), name='index'),
    # queryset = Task.objects.all(),
    # context_object_name="tasks",
    # )),
    # url(r'^delete/(?P<pk>\d+)/', TaskDelete.as_view(), name="delete"),
    url(r'^logout/$',
        'django.contrib.auth.views.logout', {'next_page': '/'},
        name='logout'),
    url(r'^authen/', views.authen_view, name='authen_view'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^delete/(?P<pk>\d+)/$', TaskDelete.as_view(), name='delete-comment'),
)
Ejemplo n.º 10
0
from django.urls import path
from . import views
from task.views import TaskListView, AboutTemplateView, TaskDetailView, TaskCreateView, TaskUpdateView, TaskDeleteView

urlpatterns = [
    path('', TaskListView.as_view(), name='home'),
    path('about', AboutTemplateView.as_view(), name='about'),
    path('create', TaskCreateView.as_view(), name='create'),
    path('update/<int:pk>', TaskUpdateView.as_view(), name='update'),
    path('task/<int:pk>', TaskDetailView.as_view(), name='task'),
    path('delete/<int:pk>', TaskDeleteView.as_view(), name='delete'),
]
Ejemplo n.º 11
0
from django.urls import path

from task.views import TaskCreateView, TaskDeleteView, TaskListView, TaskUpdateView

urlpatterns = [
    path('', TaskListView.as_view(), name='index'),
    # path('task/<uuid:pk>/', TaskDetailView.as_view(), name='task'),
    path('task/create/', TaskCreateView.as_view(), name='task_create'),
    path('task/<uuid:pk>/update/',
         TaskUpdateView.as_view(),
         name='task_update'),
    path('task/<uuid:pk>/delete/',
         TaskDeleteView.as_view(),
         name='task_delete'),
]
Ejemplo n.º 12
0
from django.conf.urls import patterns, include, url
from django.contrib.auth.forms import AuthenticationForm

from django.contrib import admin
admin.autodiscover()

# from task.views import HomeView
# from task.models import Task
from task.views import TaskListView, TaskDelete
from task import views


urlpatterns = patterns('',
	url(r'^$', TaskListView.as_view(), name='index'),
		# queryset = Task.objects.all(),
		# context_object_name="tasks",
		# )),
    # url(r'^delete/(?P<pk>\d+)/', TaskDelete.as_view(), name="delete"),
    url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'},
        name='logout'),
    url(r'^authen/', views.authen_view, name='authen_view'),
    url(r'^admin/', include(admin.site.urls)),

    url(r'^delete/(?P<pk>\d+)/$',
        TaskDelete.as_view(), name='delete-comment'),
)
Ejemplo n.º 13
0
#!/usr/bin/python
# -*- coding:utf-8 -*-
# Filename: 'urls.py'
"""Documentation"""
from django.conf.urls import include, url
from task.views import TaskListView, TaskDetailView, TaskAddView

urlpatterns = [
    url(r'^$', TaskListView.as_view(), name="task_list"),
    url(r'(?P<pk>\d+)/', TaskDetailView.as_view(), name="task_detail"),
    url(r'^add/', TaskAddView.as_view(), name="task_add"),
]

if __name__ == "__main__":
    pass
Ejemplo n.º 14
0
from django.conf.urls import patterns, include, url
from django.contrib.auth.models import User,Group
from task.views import TaskListView,TaskView

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'vulcan.views.home', name='home'),
    # url(r'^vulcan/', include('vulcan.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # url(r'^admin/', include(admin.site.urls)),
    url(r'^tasks/$', TaskListView.as_view()),
    url(r'^task/(?P<task_id>\d+)', TaskView.as_view()),
    url(r'^task/$', TaskView.as_view()),

)
Ejemplo n.º 15
0
from django.conf.urls import patterns, url

from task.views import TaskListView, TaskUpdateView

urlpatterns = patterns(
    '',
    url(r'^todo/$', TaskListView.as_view(), name='todo_listcreate'),
    url(r'^todo/(?P<pk>[\d+])/$', TaskUpdateView.as_view(),
        name='task_update'),
)