Horje
django slug int url mapping Code Example
django slug int url mapping
# in views define the int slugs then the url mapping is like this

from django.urls import path, re_path

from . import views

urlpatterns = [
    path('articles/2003/', views.special_case_2003),
    re_path(r'^articles/(?P<year>[0-9]{4})/$', views.year_archive),
    re_path(r'^articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/$', views.month_archive),
    re_path(r'^articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<slug>[\w-]+)/$', views.article_detail),
]




Python

Related
flask read form data Code Example flask read form data Code Example
str replace python regex Code Example str replace python regex Code Example
Returns the first n rows Code Example Returns the first n rows Code Example
how to load mnist dataset in python Code Example how to load mnist dataset in python Code Example
wolfram alpha python module Code Example wolfram alpha python module Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7