예제 #1
0
파일: urls.py 프로젝트: ollavrova/webapp
from django.conf.urls import patterns, url
from django.contrib import admin
from product.views import ProductList, ProductDetail, CommentAdd

admin.autodiscover()

urlpatterns = patterns(
    '',
    url(r'^$', ProductList.as_view(), name='products'),
    url(r'^products/(?P<slug>.+)/comment/$', CommentAdd.as_view(), name='comment_add'),
    url(r'^products/(?P<slug>.+)/like/$', 'product.views.like', name='like'),
    url(r'^products/(?P<slug>.+)/$', ProductDetail.as_view(), name='product_view'),
                       )
    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, logout, RegisterView, LoginView
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/<int:pk>/", ProductDetail.as_view()),
    path("product/create/", ProductCreate.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
from django.contrib import admin
from django.conf.urls import include
from django.urls import path

from product import views
from product.views import PostDetail, PostDetailCreate, ProductDetail, AddressDetail, CancelOrderDetail
urlpatterns = [
    path('api/v1/get_products/', views.get_products),
    path('api/v1/get_product/<int:id>/', ProductDetail.as_view()),
    path('api/v1/post_product/', views.post_product),
    path('api/v1/get_addresses/', views.get_addresses),
    path('api/v1/post_address/', views.post_address),
    path('api/v1/get_address/<int:id>/', AddressDetail.as_view()),
    path('api/v1/get_medicines/', views.medicine_list),
    path('api/v1/medicine_search/', views.medicine_search),
    path('api/v1/get_cancel_orders/', views.get_cancel_orders),
    path('api/v1/post_cancel_order/', views.post_cancel_order),
    path('api/v1/get_cancel_order/<int:id>', CancelOrderDetail.as_view()),
    path('api/v1/post/<int:id>/', PostDetail.as_view()),
    path('api/v1/post/', PostDetailCreate.as_view())
]
예제 #4
0
"""
from django.contrib import admin
from django.urls import path
from fcuser.views import index, logout, RegisterView, LoginView
from product.views import (
  ProductList, ProductCreate, ProductDetail,
  ProductListAPI, ProductDetailAPI
)
from order.views import OrderList, cart, OrderDetail, orderCreate

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', index),
    path('login/', LoginView.as_view()),
    path('register/', RegisterView.as_view()), #class 는 .as_view() 함수 써줘야됨
    path('logout/', logout),
    path('product/', ProductList.as_view()),
    path('product/<int:pk>/', ProductDetail.as_view()),
    path('product/create/', ProductCreate.as_view()),
    # path('order/', OrderList.as_view()),
    path('order/', OrderList),
    # path('order/<int:pk>/', OrderDetail.as_view()),
    path('order/<int:pk>/', OrderDetail),
    path('order/create/', orderCreate),
    path('cart/', cart),
    # path('order/create/', OrderCreate.as_view()),

    path('api/product/', ProductListAPI.as_view()),
    path('api/product/<int:pk>/', ProductDetailAPI.as_view()),
]
예제 #5
0
            register_date__date=target_date).count()
        order_data[date_key] = order_cnt
    extra_context = {'orders': order_data}

    return orig_index(request, extra_context)


urlpatterns = [
    re_path(
        r'^admin/manual/$',
        TemplateView.as_view(template_name='admin/manual.html',
                             extra_context={
                                 'title': '메뉴얼',
                                 'site_title': 'Django_project',
                                 'site_header': 'Django_project'
                             })),  #주소가 정확히 일치할때 연결하겠다
    path('admin/', admin.site.urls),
    path('baton/', include('baton.urls')),
    path('', index),
    path('register/', RegisterView.as_view()),  #클래스는 .as_view()사용
    path('login/', LoginView.as_view()),
    path('logout/', logout),
    path('product/', ProductList.as_view()),
    path('product/<int:pk>/', ProductDetail.as_view()),  #숫자형인데 bk란 변수로 채워짐
    path('product/create/', ProductCreate.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())
]