urls.py 619 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), # 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), # http://127.0.0.1:8000/cats/1/
  10. path('cats/<slug:cat_slug>/', views.categories_by_slug), # 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),
  13. ]