This repository has been archived by the owner on Jan 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efb3ec0
commit e7eee32
Showing
3 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
from django.urls import path, re_path | ||
from django.urls import path, re_path, register_converter | ||
|
||
from . import views | ||
|
||
|
||
class YearConverter: | ||
regex = r"20\d{2}" | ||
|
||
def to_python(self, value): | ||
return int(value) | ||
|
||
def to_url(self, value): | ||
return str(value) | ||
|
||
|
||
register_converter(YearConverter, 'year') | ||
|
||
app_name = 'instagram' # URL Reverse에서 namespace역할을 하게 됩니다. | ||
|
||
urlpatterns = [ | ||
path('', views.post_list), | ||
path('', views.post_list, name='post_list'), | ||
path('<int:pk>/', views.post_detail), | ||
# path('archives/<int:year>/', views.archives_year), | ||
# re_path(r'archives/(?P<year>20\d{2})/', views.archives_year), | ||
path('archives/<year:year>/', views.archives_year), | ||
# re_path(r'(?P<pk>\d+)/$', views.post_detail), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters