urls.py 528 B

1234567891011121314
  1. from django.urls import path, re_path, register_converter
  2. from . import views
  3. from . import converters
  4. register_converter(converters.FourDigitYearConverter, "year4")
  5. urlpatterns = [
  6. path('', views.index), # http://127.0.0.1:8000
  7. path('cats/<int:cat_id>/', views.categories), # http://127.0.0.1:8000/cats/1/
  8. path('cats/<slug:cat_slug>/', views.categories_by_slug), # http://127.0.0.1:8000/cats/asdfad/
  9. # re_path(r"^archive/(?P<year>[0-9]{4})", views.archive),
  10. path('archive/<year4:year>', views.archive),
  11. ]