urls.py 725 B

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