Skip to content

Instantly share code, notes, and snippets.

@aballah-chamakh
Created June 29, 2019 08:46
Show Gist options
  • Save aballah-chamakh/2b9eadf53ef78982bfaf0f3242f81325 to your computer and use it in GitHub Desktop.
Save aballah-chamakh/2b9eadf53ef78982bfaf0f3242f81325 to your computer and use it in GitHub Desktop.
from django.urls import path
# import function based view
from .views import (product_detail_view,product_list_view,product_create_view,product_update_view,product_delete_view)
# or class based views (this up to what your choise either you will work with cbv or fbv)
from .view import (ProductListView,ProductDetaiView,ProductCreateView,ProductUpdateView,ProductDeleteView)
urlpatterns = [
# for function based view
path('',product_list_view)
path('product/<int:pk>/',product_detail_view)
path('product/<int:pk>/create/',product_create_view)
path('product/<int:pk>/update/',product_update_view)
path('product/<int:pk>/delete/',product_delete_view)
# or for class based views
path('',ProductListView)
path('product/<int:pk>/',ProductDetaiView)
path('product/<int:pk>/create/',ProductCreateView)
path('product/<int:pk>/update/',ProductUpdateView)
path('product/<int:pk>/delete/',ProductDeleteView)
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment