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()),
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()), ]
from django.conf.urls import url from order.views import OrderCreate, OrderCreated urlpatterns = [ url(r'^create/$', OrderCreate.as_view(), name='order-create'), url(r'^(?P<pk>\d+)/created/$', OrderCreated.as_view(), name='order-created') ]
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()), ]
"""fc_django URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/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, include from order.views import OrderCreate, OrderList urlpatterns = [ path("create/", OrderCreate.as_view()), path("list/", OrderList.as_view(), name="Order_List"), ]
from django.urls import path from order.views import OrderCreate, OrderCreated, ProductClaimFormView, FastClaimFormView # , AjaxGetProduct, ClaimCallerView, urlpatterns = [ path(r'create/', OrderCreate.as_view(), name='order-create'), path(r'<int:pk>/created/', OrderCreated.as_view(), name='order-created'), path(r'fast-claim-form/create/', FastClaimFormView.as_view(), name='fast-claim-form'), path(r'product-claim-form/create/', ProductClaimFormView.as_view(), name='product-claim-form'), # path(r'claim-caller/create/', ClaimCallerView.as_view(), name='claim_caller'), ]
from django.contrib import admin from django.urls import path from order.views import OrderCreate, OrderDone app_name = 'order' urlpatterns = [ path('checkout/', OrderCreate.as_view(), name='create'), path('checkout/thanks', OrderDone.as_view(), name='created'), ]
from django.conf.urls import patterns, url from django.contrib.auth.decorators import login_required from order.views import OrderList, OrderCreate, OrderUpdate, OrderDelete urlpatterns = patterns('', url(r'^$', login_required(OrderList.as_view()), name='order_list'), url(r'^new$', login_required(OrderCreate.as_view()), name='order_new'), url(r'^edit/(?P<pk>\d+)$', login_required(OrderUpdate.as_view()), name='order_update'), url(r'^delete/(?P<pk>\d+)$', login_required(OrderDelete.as_view()), name='order_delete'), )
"""sales URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/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 order.views import OrderList, OrderCreate, OrderDelete, OrderUpdate urlpatterns = [ url(r'^$', OrderList.as_view(),name='orders'), url(r'novo$', OrderCreate.as_view(),name='order_new'), url(r'editar/(?P<pk>\d+)$', OrderUpdate.as_view(),name='order_update'), url(r'excluir/(?P<pk>\d+)$',OrderDelete.as_view(), name='order_delete') # url(r'excluir$', OrderDelete.as_view(), name='order_delete') ]