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)
15
15
day - ((0|1|2)?([1-9])|[1-3]0|31)
16
16
id - \d+
17
17
pk - \d+
18
+ page - \d+
18
19
uuid - [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}
19
20
```
20
21
Original file line number Diff line number Diff line change 5
5
_macros_library = {
6
6
'id' : r'\d+' ,
7
7
'pk' : r'\d+' ,
8
+ 'page' : r'\d+' ,
8
9
'slug' : r'[\w-]+' ,
9
10
'year' : r'\d{4}' ,
10
11
'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):
42
42
'^product/(?P<pk>\d+)/(?P<product_pk>\d+)$' )
43
43
self .assertEqual (MacroUrlPattern ('product/:pk/:product_pk/:news_pk' ).compiled ,
44
44
'^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+)$' )
45
53
46
54
def test_slug (self ):
47
55
self .assertEqual (MacroUrlPattern ('page/:slug' ).compiled , '^page/(?P<slug>[\w-]+)$' )
You can’t perform that action at this time.
0 commit comments