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
22
33Django Macros Url makes it easy to write (and read) url patterns in your django applications by using macros.
44
Original file line number Diff line number Diff line change 22
33from django .conf .urls import url as baseurl
44
5- VERSION = (0 , 1 , 1 )
5+ VERSION = (0 , 1 , 2 )
66
77_macros_library = {
88 'id' : r'\d+' ,
9+ 'pk' : r'\d+' ,
910 'slug' : r'[\w-]+' ,
1011 'year' : r'\d{4}' ,
1112 '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):
3636 self .assertEqual (MacroUrlPattern ('product/:id/:product_id/:news_id' ).compiled ,
3737 '^product/(?P<id>\d+)/(?P<product_id>\d+)/(?P<news_id>\d+)$' )
3838
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+
3947 def test_slug (self ):
4048 self .assertEqual (MacroUrlPattern ('page/:slug' ).compiled , '^page/(?P<slug>[\w-]+)$' )
4149 self .assertEqual (MacroUrlPattern ('page/:category_slug/:slug' ).compiled ,
You can’t perform that action at this time.
0 commit comments