File tree Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ month - (0?([1-9])|10|11|12)
1515day - ((0|1|2)?([1-9])|[1-3]0|31)
1616id - \d+
1717pk - \d+
18+ page - \d+
1819uuid - [a-fA-F0-9]{8}-?[a-fA-F0-9]{4}-?[1345][a-fA-F0-9]{3}-?[a-fA-F0-9]{4}-?[a-fA-F0-9]{12}
1920```
2021
Original file line number Diff line number Diff line change 55_macros_library = {
66 'id' : r'\d+' ,
77 'pk' : r'\d+' ,
8+ 'page' : r'\d+' ,
89 'slug' : r'[\w-]+' ,
910 'year' : r'\d{4}' ,
1011 'month' : r'(0?([1-9])|10|11|12)' ,
Original file line number Diff line number Diff line change @@ -42,6 +42,14 @@ def test_pk(self):
4242 '^product/(?P<pk>\d+)/(?P<product_pk>\d+)$' )
4343 self .assertEqual (MacroUrlPattern ('product/:pk/:product_pk/:news_pk' ).compiled ,
4444 '^product/(?P<pk>\d+)/(?P<product_pk>\d+)/(?P<news_pk>\d+)$' )
45+
46+ def test_page (self ):
47+ self .assertEqual (MacroUrlPattern ('page/:page' ).compiled , '^page/(?P<page>\d+)$' )
48+ self .assertEqual (MacroUrlPattern ('product/:product_page' ).compiled , '^product/(?P<product_page>\d+)$' )
49+ self .assertEqual (MacroUrlPattern ('product/:page/:product_page' ).compiled ,
50+ '^product/(?P<page>\d+)/(?P<product_page>\d+)$' )
51+ self .assertEqual (MacroUrlPattern ('product/:page/:product_page/:news_page' ).compiled ,
52+ '^product/(?P<page>\d+)/(?P<product_page>\d+)/(?P<news_page>\d+)$' )
4553
4654 def test_slug (self ):
4755 self .assertEqual (MacroUrlPattern ('page/:slug' ).compiled , '^page/(?P<slug>[\w-]+)$' )
You can’t perform that action at this time.
0 commit comments