Exemplo n.º 1
0
from django.conf.urls import url

from categories.views import CategoryListView, CategoryCreate, CategoryDetailView, CategoryUpdate, CategoryDelete

urlpatterns = [
    url(r'^$', CategoryListView.as_view(), name='category-list'),
    url(r'^(?P<pk>\d+)/$',
        CategoryDetailView.as_view(),
        name='category-detail'),
    url(r'category/add/$', CategoryCreate.as_view(), name='category-add'),
    url(r'category/(?P<pk>[0-9]+)/$',
        CategoryUpdate.as_view(),
        name='category-update'),
    url(r'category/(?P<pk>[0-9]+)/delete/$',
        CategoryDelete.as_view(),
        name='category-delete'),
]
Exemplo n.º 2
0
from django.conf.urls import patterns, url
from django.views.generic import TemplateView

from categories.views import CategoryList, CategoryCreate, CategoryDetail, CategoryUpdate, CategoryDelete

# The leading / is in the top level pattern which might be like:
#    url(r'^things/', include('yourapp.urls')),

urlpatterns = patterns(
    '',
    url(r'^new/$', CategoryCreate.as_view(), name='category_create'),
    url(r'^(?P<pk>\d+)/$', CategoryDetail.as_view(), name='category_detail'),
    url(r'^(?P<pk>\d+)/update/$', CategoryUpdate.as_view(), name='category_update'),
    url(r'^(?P<pk>\d+)/delete/$', CategoryDelete.as_view(), name='category_delete'),
    url(r'^', CategoryList.as_view(), name='category_list'),
)
Exemplo n.º 3
0
    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 entry.views import NoteList, NoteDetail, NoteCreate
from categories.views import CategoryList, CategoryDetail, CategoryCreate, CategoryUpdate
#from entry import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('note/', NoteList.as_view(), name='note_list_view'),
    path('note/<int:pk>/', NoteDetail.as_view(), name='note_detail_view'),
    path('note/create', NoteCreate.as_view(), name='note_create_view'),
    #path('note/encrypt', NoteCreate., name='note_enc_view'),
    path('category/', CategoryList.as_view(), name='category_list_view'),
    path('category/<int:pk>/',
         CategoryDetail.as_view(),
         name='category_detail_view'),
    path('category/create/',
         CategoryCreate.as_view(),
         name='category_create_view'),
    path('category/update/<int:pk>',
         CategoryUpdate.as_view(),
         name='category_update_view'),
    #path('category/test', views.test, name='test_view'),
]
Exemplo n.º 4
0
from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth.decorators import login_required

from categories.views import category_detail, categories_list, category_create, category_edit, CategoryCreate

urlpatterns = [
    url(r'^$', categories_list, name='all_categories'),
    url(r'^(?P<category_id>\d+)/detail$',
        category_detail,
        name='category_detail'),
    url(r'^create$',
        login_required(CategoryCreate.as_view()),
        name='category_create'),
    url(r'^(?P<category_id>\d+)/edit$', category_edit, name='category_edit'),
]
Exemplo n.º 5
0
from django.conf.urls import url

from categories.views import CategoryEdit
from categories.views import CategoryCreate
from categories.views import CategoryViews
from categories.views import CategoryDetails

urlpatterns = [
    url(r'^$', CategoryViews.as_view(), name='categories'),
    url(r'^(?P<category_id>\d+)/$',
        CategoryDetails.as_view(pk_url_kwarg='category_id'),
        name='category_details'),
    url(r'^(?P<category_id>\d+)/edit/$',
        CategoryEdit.as_view(pk_url_kwarg='category_id'),
        name='category_edit'),
    url(r'^create/$', CategoryCreate.as_view(), name='category_create')
]
Exemplo n.º 6
0
from django.urls import path
from categories.views import CategoryList, CategoryDetailView, CategoryCreate, CategoryUpdate

urlpatterns = [
    path('', CategoryList.as_view(), name='category-list'),
    path('category/<slug:slug>-<int:pk>/', CategoryDetailView.as_view(), name='category'),
    path('category/add/', CategoryCreate.as_view(), name='category-add'),
    path('category/update/<int:pk>/', CategoryUpdate.as_view(), name='category-update'),

]
Exemplo n.º 7
0
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth.decorators import login_required

from categories.views import  categories_list, category_detail, CategoryEdit, CategoryCreate, testfunc

urlpatterns = [

    url(r'^$', login_required(categories_list), name='categories_list'),
    url(r'^(?P<pk>\d+)/detail/$', login_required(category_detail), name='category_detail'),
    url(r'^(?P<pk>\d+)/edit/$', login_required(CategoryEdit.as_view()), name='category_edit'),
    url(r'^create/$', login_required(CategoryCreate.as_view()), name = 'category_create'),
    url (r'^test/$', testfunc),
]
Exemplo n.º 8
0
from rest_framework import routers
from categories import views

from categories.views import (
    CategoryViewSet,
    CategoryCreate,
    CategoryDelete,
    CategoryUpdate,
    CategoryList,
    CategoryDetail,
)

router = routers.DefaultRouter()
router.register(r"categories-api", CategoryViewSet)

app_name = "categories"
urlpatterns = [
    path("", include(router.urls, )),
    path("category/add/", CategoryCreate.as_view(), name="category-add"),
    path("category/<int:pk>/",
         CategoryDetail.as_view(),
         name="category-detail"),
    path("category/<int:pk>/update/",
         CategoryUpdate.as_view(),
         name="category-update"),
    path("category/<int:pk>/delete/",
         CategoryDelete.as_view(),
         name="category-delete"),
    path("category/", CategoryList.as_view(), name="category-list"),
]