urls.py 678 B

12345678910111213141516
  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, name='home'), # http://127.0.0.1:8000
  7. # path('details/', views.post_detail),
  8. # path('posts/<int:year>', views.posts_list),
  9. path('cats/<int:cat_id>/', views.categories, name='cat_id'), # http://127.0.0.1:8000/cats/1/
  10. path('cats/<slug:cat_slug>/', views.categories_by_slug, name='cats'), # http://127.0.0.1:8000/cats/asdfad/
  11. # re_path(r"^archive/(?P<year>[0-9]{4})", views.archive),
  12. path('archive/<year4:year>', views.archive, name='archive'),
  13. ]