Exemplo n.º 1
0
    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, re_path
from django.conf.urls import include
from registration import views
from django.conf import settings
from django.conf.urls.static import static

from products.views import (ProductDetailSlugView, ProductFeaturedDetailView,
                            ProductFeaturedListView, ProductListView,
                            product_list_view, product_detail_view,
                            ProductDetailView)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('about/', views.about, name='about'),
    path('', ProductListView.as_view(), name='eshop'),
    path('registration/', include('registration.urls')),
    path('logout/', views.user_logout, name='logout'),
    path('special/', views.special, name='special '),
    path('feature/', ProductFeaturedListView.as_view()),
    re_path('featured/(?P<pk>\d+)/', ProductFeaturedDetailView.as_view()),
    path('product/', include("products.urls", namespace="products")),
    #path('cart/',include('cart.urls',namespace='cart')),
    path('paypal/', include('paypal.standard.ipn.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Exemplo n.º 2
0
from django.contrib import admin
from django.urls import path

from products.views import (ProductListView, product_list_view,
                            ProductDetailView, ProductDeatailSlugView,
                            product_detail_view, ProductFeaturedListView,
                            ProductFeaturedDetailView)

from .views import home_page, about_page, contact_page, login_page, register_page

urlpatterns = [
    path('', home_page),
    path('about/', about_page),
    path('contact/', contact_page),
    path('login/', login_page),
    path('register/', register_page),
    path('featured/', ProductFeaturedListView.as_view()),
    path('featured/<int:pk>', ProductFeaturedDetailView.as_view()),
    path('products/', ProductListView.as_view()),
    path('products-fbv/', product_list_view),
    path('products/<int:pk>', ProductDetailView.as_view()),
    path('products/<slug:slug>', ProductDeatailSlugView.as_view()),
    path('products-fbv/<int:pk>', product_detail_view),
    path('admin/', admin.site.urls),
]

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)
Exemplo n.º 3
0
    url(r'^$', home),
    # path(r"^$",home), # Why does this not work???
    url(r'^about/$', aboutUs),  # you can either use url matching
    path("contact/", contactUs),  # you can also use path matching
    path('admin/', admin.site.urls),
    path('blog/', homepage),
    path('login/', login_page),
    path('register/', register_page),
    url(r'^products/$', ProductListView.as_view()),
    path('products-fbv/', product_list_view),

    # url(r'^products/(?P<pk>\d+)/$', ProductDetailView.as_view()),
    url(r'^products/(?P<slug>[\w-]+)/$', ProductDetailSlugView.as_view()),
    url(r'^products-fbv/(?P<pk>\d+)/$', product_detail_view),
    url(r'^featured/$', ProductFeaturedListView.as_view()),
    url(r'^featured/(?P<pk>\d+)/$', ProductFeaturedDetailView.as_view()),
]

if settings.DEBUG:  # This is so that if debug is on, static files won't be served
    urlpatterns = urlpatterns + static(settings.STATIC_URL,
                                       document_root=settings.STATIC_ROOT)
    urlpatterns = urlpatterns + static(settings.MEDIA_URL,
                                       document_root=settings.MEDIA_ROOT)

# random string generator in python
from django.utils.text import slugify


def unique_slug_generator(instance, new_slug=None):
    if new_slug is not None:
        slug = new_slug
Exemplo n.º 4
0
urlpatterns = [
    path('admin/', admin.site.urls),
    path('',home,name="home"),
    path('contact/',contact,name="contact"),
    path('about/',about,name="about"),
    path('login/',LoginView.as_view(),name="login"),
    path('checkout/address/create/',checkout_address_create_view,name="checkout_address_create"),
    path('checkout/address/reuse/',checkout_address_reuse_view,name="checkout_address_reuse"),
    path('register/guest/',guest_register_user,name="guest_register"),
    path('logout/',LogoutView.as_view(),name="logout"),
    path('api/cart/',cart_detail_api_view,name="api-cart"),
    #path('cart/',cart_home,name="cart"),
    path('cart/',include(("carts.urls",'carts'),namespace='carts')),
    path('register/',RegisterView.as_view(),name="register"),
    path('boot/',TemplateView.as_view(template_name="boot/boot.html"),name="boot"),
    path('products-fbv/',product_list_view,name="product_fb"),
    path('products/',include(("products.urls",'product'),namespace='product')),
    path('products-fbv/<int:pk>/',product_detail_view,name="product_details_fb"),
    #path('products/<int:pk>/',ProductDetailView.as_view(),name="products_details"),
    path('featured/',ProductFeaturedListLiew.as_view(),name="featured"),
    path('featured/<int:pk>/',ProductFeaturedDetailView.as_view(),name="featured-details"),
    #path('products/<slug:slug>/',ProductDetailSlugView.as_view(),name="products_details"),
    path('search/',include(("search.urls",'search'),namespace='search')),


]

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)
Exemplo n.º 5
0
from .views import (home_page, about_page, contact_page, login_page,
                    register_page)

from products.views import (ProductListView, product_list_view,
                            ProductDetailView, product_detail_view,
                            ProductFeaturedListView, ProductFeaturedDetailView)

urlpatterns = [
    path('', home_page, name="homepage"),
    path('about/', about_page, name="about"),
    path('contact/', contact_page, name="contact"),
    path('login/', login_page, name="login"),
    path('register/', register_page, name="register"),
    path('featured/', ProductFeaturedListView.as_view(), name="featured"),
    path('featured/<int:pk>/',
         ProductFeaturedDetailView.as_view(),
         name="featured-detail"),
    path('products/', ProductListView.as_view(), name="products"),
    path('products-fbv/', product_list_view, name="products-fbv"),
    path('products/<int:pk>/',
         ProductDetailView.as_view(),
         name="products-detail"),
    path('products-fbv/<int:pk>/',
         product_detail_view,
         name="products-detail-fbv"),
    path('admin/', admin.site.urls),
]

if settings.DEBUG:
    urlpatterns = urlpatterns + \
        static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)