Skip to content

Commit b2fac6f

Browse files
author
Alexandr Shurigin
committed
v0.1.2 version bump.
Added macros pk (type: id) to defaults. Added tests.
1 parent 7717477 commit b2fac6f

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

CHANGELOG.markdown

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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.

README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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

33
Django Macros Url makes it easy to write (and read) url patterns in your django applications by using macros.
44

macrosurl/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
from 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)',

tests/urls.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)