File tree Expand file tree Collapse file tree 4 files changed +25
-2
lines changed Expand file tree Collapse file tree 4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change
1
+ v0.1.2
2
+ ------
3
+
4
+ added pk macros
5
+
6
+ v0.1.1
7
+ ------
8
+
9
+ Support for include('path.to.url') view added. Urls normalization by adding dollar at end fixed to support include. Tests added.
10
+
11
+ v0.1.0
12
+ ------
13
+
14
+ Basic functionality done.
Original file line number Diff line number Diff line change 1
- # [ Django Macros Url] ( https://github.com/phpdude/django-macros-url/ ) v0.1.1 - Routing must be simple as possible
1
+ # [ Django Macros Url] ( https://github.com/phpdude/django-macros-url/ ) v0.1.2 - Routing must be simple as possible
2
2
3
3
Django Macros Url makes it easy to write (and read) url patterns in your django applications by using macros.
4
4
Original file line number Diff line number Diff line change 2
2
3
3
from django .conf .urls import url as baseurl
4
4
5
- VERSION = (0 , 1 , 1 )
5
+ VERSION = (0 , 1 , 2 )
6
6
7
7
_macros_library = {
8
8
'id' : r'\d+' ,
9
+ 'pk' : r'\d+' ,
9
10
'slug' : r'[\w-]+' ,
10
11
'year' : r'\d{4}' ,
11
12
'month' : r'(0?([1-9])|10|11|12)' ,
Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ def test_id(self):
36
36
self .assertEqual (MacroUrlPattern ('product/:id/:product_id/:news_id' ).compiled ,
37
37
'^product/(?P<id>\d+)/(?P<product_id>\d+)/(?P<news_id>\d+)$' )
38
38
39
+ def test_pk (self ):
40
+ self .assertEqual (MacroUrlPattern ('page/:pk' ).compiled , '^page/(?P<pk>\d+)$' )
41
+ self .assertEqual (MacroUrlPattern ('product/:product_pk' ).compiled , '^product/(?P<product_pk>\d+)$' )
42
+ self .assertEqual (MacroUrlPattern ('product/:pk/:product_pk' ).compiled ,
43
+ '^product/(?P<pk>\d+)/(?P<product_pk>\d+)$' )
44
+ self .assertEqual (MacroUrlPattern ('product/:pk/:product_pk/:news_pk' ).compiled ,
45
+ '^product/(?P<pk>\d+)/(?P<product_pk>\d+)/(?P<news_pk>\d+)$' )
46
+
39
47
def test_slug (self ):
40
48
self .assertEqual (MacroUrlPattern ('page/:slug' ).compiled , '^page/(?P<slug>[\w-]+)$' )
41
49
self .assertEqual (MacroUrlPattern ('page/:category_slug/:slug' ).compiled ,
You can’t perform that action at this time.
0 commit comments