示例#1
0
#from django.urls import include,path,re_path
from django.conf.urls import url
from product.views import ProductCreate, ProductList, ProductUpdate

urlpatterns = [
    url(r'^$', ProductList.as_view(), name='productlist'),
    url(r'^new/$', ProductCreate.as_view(), name="newproduct"),
    url(r'^(?P<pk>[0-9]+)/update$',
        ProductUpdate.as_view(),
        name="editproduct"),
    #url(r'^(?P<pk>[0-9]+)/delete',MeetingDelete.as_view(),name="deletemeeting"),
]
示例#2
0
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 user.views import index, RegisterView, LoginView, logout
from product.views import (
    ProductList,
    ProductCreate,
    ProductDetail,
    ProductListAPI,
    ProductDetailAPI,
)
from order.views import OrderCreate, OrderList

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', index),
    path('register/', RegisterView.as_view()),
    path('login/', LoginView.as_view()),
    path('logout/', logout),
    path('product/', ProductList.as_view()),
    path('product/create/', ProductCreate.as_view()),
    path('product/<int:pk>/', ProductDetail.as_view()),
    path('order/', OrderList.as_view()),
    path('order/create/', OrderCreate.as_view()),
    path('api/product/', ProductListAPI.as_view()),
    path('api/product/<int:pk>/', ProductDetailAPI.as_view()),
]
示例#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 stuser.views import index, RegisterView, LoginView
from product.views import ProductList, ProductCreate, ProductDetail
from order.views import OrderCreate

urlpatterns = [
    path('admin/', admin.site.urls, name='admin'),
    path('', index, name='index'),
    path('register/', RegisterView.as_view(), name='register'),
    path('login/', LoginView.as_view(), name='login'),
    path('product/', ProductList.as_view(), name='product'),
    path('product/<int:pk>/', ProductDetail.as_view(), name='productdetail'),
    path('product/create/', ProductCreate.as_view(), name='productcreate'),
    path('order/create/', OrderCreate.as_view(), name='ordercreate'),
]

#  path('admin/', admin.site.urls),
#     path('', index),
#     path('register/', RegisterView.as_view()),
#     path('login/', LoginView.as_view()),
#     path('product/', ProductList.as_view()),
#     path('product/<int:pk>/', ProductDetail.as_view()),
#     path('product/create/', ProductCreate.as_view()),
#     path('order/create/', OrderCreate.as_view()),
示例#4
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 fcuser.views import index, RegisterView, LoginView
from product.views import ProductList, ProductCreate, ProductDetail
from order.views import OrderCreate, OrderList

urlpatterns = [
    path("admin/", admin.site.urls),
    path("", index),
    path("register/",
         RegisterView.as_view()),  # 뷰클래스 사용시 as_view() 함수를 사용해야합니다
    path("login/", LoginView.as_view()),
    path("product/", ProductList.as_view()),
    path("product/<int:pk>/", ProductDetail.as_view()),
    # path("product/create", ProductCreate.as_view()) 로 입력해서 계속 에러가 났엇음 슬래시 주의할것
    path("product/create/", ProductCreate.as_view()),
    path("order/", OrderList.as_view()),
    path("order/create/", OrderCreate.as_view()),
]
示例#5
0
文件: urls.py 项目: Ataiskih/techshop
from django.urls import path
from product.views import (CategoryDetailView, ProductDetailView,
                           ProductCreate, delete_post, product_edit, products)

urlpatterns = [
    path("category/<int:pk>/", CategoryDetailView.as_view(), name="category"),
    path("<int:pk>/", ProductDetailView.as_view(), name="product"),
    path("create/", ProductCreate.as_view(), name="product-create"),
    path("delete/<int:id>/", delete_post, name="product-delete"),
    path("edit/<int:id>/", product_edit, name="product-edit"),
    path("all/", products, name="products"),
]
示例#6
0
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 product.views import (ProductCreate, ProductDelete, ProductDetailView,
                           ProductList, ProductUpdate)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('product/', ProductList.as_view(), name='product_list'),
    path('product/<int:pk>/detail',
         ProductDetailView.as_view(),
         name='product_detail'),
    path('product/add/', ProductCreate.as_view(), name='product_add'),
    path('product/<int:pk>/update',
         ProductUpdate.as_view(),
         name='product_update'),
    path('product/<int:pk>/delete/',
         ProductDelete.as_view(),
         name='product_delete'),
]
示例#7
0
from django.conf.urls import url
from product.views import manage_product_categories, manage_product_types, manage_units_of_measurement, ProductList, ProductDetail, ProductCreate, ProductUpdate, ProductDelete, manage_pricelist

urlpatterns = [
    url(r'^$', ProductList.as_view(), name='product-list'),
    url(r'^detail/(?P<pk>[0-9]*)/$',
        ProductDetail.as_view(),
        name='product-detail'),
    url(r'^add/$', ProductCreate.as_view(), name='product-add'),
    url(r'^update/(?P<pk>[0-9]*)/$',
        ProductUpdate.as_view(),
        name='product-update'),
    url(r'^delete/(?P<pk>[0-9]*)/$',
        ProductDelete.as_view(),
        name="product-delete"),
    url(r'^type/$', manage_product_types, name='product-type-list'),
    url(r'^uom/$', manage_units_of_measurement, name='uom-list'),
    url(r'category/$', manage_product_categories,
        name='product-category-list'),
    url(r'pricelist/$', manage_pricelist, name="pricelist"),
]