from django.conf.urls import url from products.views import ( ProductListView, ProductDetail, SearchView, ) urlpatterns = [ url(r'^category/(?P<slug>[-\w]+)/$', ProductListView.as_view(), name='product_list'), url(r'^category/(?P<slug>[-\w]+)/product/(?P<pk>\d+)/$', ProductDetail.as_view(), name='product_detail'), url( r'^search/$', SearchView.as_view(), name='search', ), ]
from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.conf import settings from products.views import ProductList, ProductDetail, CategoryList, ContactList, CartList, AddtoCartList, RemoveFromCartList # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: url(r'^$', ProductList.as_view(), name='index'), # url(r'^workshopstore/', include('workshopstore.foo.urls')), # url(r'^products/$', 'products.views.index'), url(r'^products/$', ProductList.as_view()), url(r'^products/(?P<cat>\d+)/$', CategoryList.as_view()), url(r'^product/(?P<pk>\d+)/$', ProductDetail.as_view()), url(r'^contact/$', ContactList.as_view()), url(r'^cart/$', CartList.as_view()), url(r'^cart/add/(?P<product_id>\d+)/$', AddtoCartList.as_view()), url(r'^cart/remove/(?P<product_id>\d+)/$', RemoveFromCartList.as_view()), url(r'^media/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT, }), # 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)), )
from django.conf.urls import patterns, url from products.views import ProductList, ProductCreate, ProductDetail, ProductUpdate, ProductDelete from products.views import OrderList, OrderCreate, OrderDetail, OrderUpdate, OrderDelete # The leading / is in the top level pattern which might be like: # url(r'^things/', include('yourapp.urls')), urlpatterns = patterns( '', url(r'^orders/new/$', OrderCreate.as_view(), name='order_create'), url(r'^orders/(?P<pk>\d+)/$', OrderDetail.as_view(), name='order_detail'), url(r'^orders/(?P<pk>\d+)/update/$', OrderUpdate.as_view(), name='order_update'), url(r'^orders/(?P<pk>\d+)/delete/$', OrderDelete.as_view(), name='order_delete'), url(r'^orders/', OrderList.as_view(), name='order_list'), url(r'^new/$', ProductCreate.as_view(), name='product_create'), url(r'^(?P<pk>\d+)/$', ProductDetail.as_view(), name='product_detail'), url(r'^(?P<pk>\d+)/update/$', ProductUpdate.as_view(), name='product_update'), url(r'^(?P<pk>\d+)/delete/$', ProductDelete.as_view(), name='product_delete'), url(r'^', ProductList.as_view(), name='product_list'), )
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 an import: from blog import urls as blog_urls 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) """ from django.conf.urls import include, url from django.contrib import admin from main import views from products.views import ProductList,ProductUpdate,ProductCreate, ProductUpdate, ProductDetail urlpatterns = [ #url(r'^$', include('main.urls')), url(r'^$', views.do_login, name = 'do_login'), url(r'^login/$', views.do_login, name = 'do_login'), url(r'^home/$', views.home, name = 'home'), url(r'^admin/', include(admin.site.urls)), url(r'^orgform/', include('organization.urls')), url(r'^about',views.about, name= 'about'), url(r'^p', view = ProductList.as_view(), name = "productlist"), url(r'^u/(?P<pk>\d+)/$', view = ProductUpdate.as_view(success_url="/p"), name = "productupdate"), url(r'^d/(?P<pk>\d+)/$', view = ProductDetail.as_view(), name = "productudetail"), url(r'^c/$', view = ProductCreate.as_view(success_url="/p"), name = "productcreate"), ]
from django.urls import include, path from rest_framework import routers from products import views from products.views import ( ProductViewSet, ProductCreate, ProductDelete, ProductUpdate, ProductList, ProductDetail, ) router = routers.DefaultRouter() router.register(r"product-api", ProductViewSet) app_name = "products" urlpatterns = [ path("", include(router.urls, )), path("product/add/", ProductCreate.as_view(), name="product-add"), path("product/<int:pk>/", ProductDetail.as_view(), name="product-detail"), path("product/<int:pk>/update/", ProductUpdate.as_view(), name="product-update"), path("product/<int:pk>/delete/", ProductDelete.as_view(), name="product-delete"), path("product/", ProductList.as_view(), name="product-list"), ]
from django.contrib import admin from django.urls import path from django.conf import settings from django.conf.urls.static import static from .views import home_page, about_page, contact_page from products.views import ProductList, ProductDetail urlpatterns = [ path('admin/', admin.site.urls), path('', home_page), path('about-us/', about_page, name='about'), path('contact-us/', contact_page, name='contact'), path('products/<category>/<slug>/', ProductList.as_view(), name='list'), path('item/<category>/<slug>/<sku>/', ProductDetail.as_view(), name='detail'), ] if settings.DEBUG: urlpatterns = urlpatterns + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns = urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
''' Products routing configurations ''' from django.conf.urls import url from products.views import ProductCreate, ProductUpdate, ProductDelete, \ ProductList, ProductDetail urlpatterns = [ # ... url(r'product/$', ProductList.as_view(), name='product-list'), url(r'product/add/$', ProductCreate.as_view(), name='product-add'), url(r'product/view/(?P<pk>[0-9]+)/$', ProductDetail.as_view(), \ name='product-details'), url(r'product/edit/(?P<pk>[0-9]+)/$', ProductUpdate.as_view(), \ name='product-update'), url(r'product/(?P<pk>[0-9]+)/delete/$', ProductDelete.as_view(), \ name='product-delete') ]
from shopping_baskets.views import ShoppingBasketView from users.views import SignupView api_urls = [ path('products/', include(('products.urls', 'products'), namespace='products')), path('categories/', include(('categories.urls', 'categories'), namespace='categories')), path( 'shopping_baskets/', include(('shopping_baskets.urls', 'shopping_baskets'), namespace='shopping_baskets') ), ] ui_urls = [ path('categories/<int:category_id>/products/add/', ProductCreateView.as_view(), name='product-create-ui'), path('categories/<int:category_id>/products/<int:pk>/', ProductDetail.as_view(), name='products-detail'), path('categories/<int:category_id>/products/<int:pk>/edit/', ProductUpdateView.as_view(), name='product-edit'), path( 'categories/<int:category_id>/products/<int:pk>/delete/', ProductDeleteView.as_view(), name='product-delete' ), path('categories/<int:category_id>/products/', ProductList.as_view(), name='products'), path('categories/add/', CategoryCreateView.as_view(), name='category-create-ui'), path('categories/<slug:pk>/edit/', CategoryUpdateView.as_view(), name='category-edit'), path('categories/<int:pk>/delete/', CategoryDeleteView.as_view(), name='category-delete'), path('shopping-basket/', ShoppingBasketView.as_view(), name='shopping-basket-ui'),
from django.urls import path from products.views import ( # product_list, product_detail, ProductCreate, ProductDelete, ProductUpdate, ProductList, ProductDetail # product_create, product_update, product_delete ) app_name = 'products' urlpatterns = [ path('', ProductList.as_view(), name='index'), # path('', product_list, name='index'), path('<int:pk>/detail/', ProductDetail.as_view(), name='detail'), # path('<int:pk>/detail/', product_detail, name='detail'), path('create/', ProductCreate.as_view(), name='create'), path('<int:pk>/delete/', ProductDelete.as_view(), name='delete'), # path('<int:pk>/delete/', product_delete, name='delete'), path('<int:pk>/update/', ProductUpdate.as_view(), name='update'), # path('<int:pk>/update/', product_update, name='update'), ]
from django.urls import path from products.views import ProductList, ProductDetail urlpatterns = [ path('', ProductList.as_view()), path('<int:pk>', ProductDetail.as_view()) ]
from django.views.generic import TemplateView, ListView from fast_foods.views import ff_listview from hotels.views import HotelView, HotelDetailView from pubs.views import pubs_view from products.views import ProductsView, ProductDetail from django.contrib.auth.views import LoginView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', TemplateView.as_view(template_name="home.html"), name="home"), url(r'^login/', LoginView.as_view(template_name='login.html'), name="login"), url(r'^restaurants/', include('restaurants.urls', namespace="restaurants")), url(r'^items/', include('menus.urls', namespace="menus")), url(r'^fast_foods/$', ff_listview), url(r'^hotels/$', HotelView.as_view()), url(r'^hotels/(?P<slug>[\w-]+)/$', HotelDetailView.as_view()), url(r'^pubs/$', pubs_view), #url(r'^restaurants/(?P<slug>\w+)/$', RestaurantListView.as_view() ), url(r'^contact/$', TemplateView.as_view(template_name="contact.html"), name="contact"), url(r'^about/$', TemplateView.as_view(template_name="about.html"), name="about"), url(r'^products/$', ProductsView.as_view()), url(r'^products/(?P<slug>[\w-]+)/$', ProductDetail.as_view()) ]
from django.urls import path from products.views import (ProductList, ProductDetail, ProductCreate, ProductUpdate, ProductDelete) app_name = 'products' urlpatterns = [ path('<slug:slug>/', ProductDetail.as_view(), name='detail'), path('', ProductList.as_view(), name='index'), path('create/', ProductCreate.as_view(), name='create'), path('<int:pk>/update/', ProductUpdate.as_view(), name='update'), path('<int:pk>/delete/', ProductDelete.as_view(), name='delete'), ]
from products.views import ProductDetail from django.conf import settings from django.conf.urls.static import static from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^products/(?P<slug>[-\w]+)/', ProductDetail.as_view(), name="product-detail"), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \ + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.conf.urls import patterns, include, url from products.views import FrontView, CategoryDetail, TraderDetail, ProductDetail, RegionView from vyazma import settings from shop import urls as shop_urls from django.contrib.staticfiles.urls import static from django.contrib import admin from django.views.generic import TemplateView admin.autodiscover() urlpatterns = patterns('', url(r'^$', FrontView.as_view(), name='front'), url(r'^category/(?P<slug>[0-9A-Za-z-_.//]+)/$', CategoryDetail.as_view(), name='category'), url(r'^traders/(?P<slug>[0-9A-Za-z-_.//]+)/$', TraderDetail.as_view(), name='trader'), url(r'^regions/(?P<url>[0-9A-Za-z-_.//]+)/$', RegionView.as_view(), name='region'), url(r'^products/(?P<slug>[0-9A-Za-z-_.//]+)/$', ProductDetail.as_view(), name='product_details'), # url(r'^catalog/$', CatalogView.as_view(), name='catalog'), # url(r'^catalog/(?P<slug>[0-9A-Za-z-_.//]+)/$', CatalogCategory.as_view(), name='catalog_detail'), # url(r'^painters/(?P<slug>[0-9A-Za-z-_.//]+)/$', CategoryDetail.as_view(), name='painters_detail'), url(r'^admin/', include(admin.site.urls)), (r'^shop/', include(shop_urls)), ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)