Skip to content

Commit

Permalink
v0.1.2 version bump.
Browse files Browse the repository at this point in the history
Added macros pk (type: id) to defaults. Added tests.
  • Loading branch information
Alexandr Shurigin committed Jun 7, 2014
1 parent 7717477 commit b2fac6f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
v0.1.2
------

added pk macros

v0.1.1
------

Support for include('path.to.url') view added. Urls normalization by adding dollar at end fixed to support include. Tests added.

v0.1.0
------

Basic functionality done.
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [Django Macros Url](https://github.com/phpdude/django-macros-url/) v0.1.1 - Routing must be simple as possible
# [Django Macros Url](https://github.com/phpdude/django-macros-url/) v0.1.2 - Routing must be simple as possible

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

Expand Down
3 changes: 2 additions & 1 deletion macrosurl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

from django.conf.urls import url as baseurl

VERSION = (0, 1, 1)
VERSION = (0, 1, 2)

_macros_library = {
'id': r'\d+',
'pk': r'\d+',
'slug': r'[\w-]+',
'year': r'\d{4}',
'month': r'(0?([1-9])|10|11|12)',
Expand Down
8 changes: 8 additions & 0 deletions tests/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ def test_id(self):
self.assertEqual(MacroUrlPattern('product/:id/:product_id/:news_id').compiled,
'^product/(?P<id>\d+)/(?P<product_id>\d+)/(?P<news_id>\d+)$')

def test_pk(self):
self.assertEqual(MacroUrlPattern('page/:pk').compiled, '^page/(?P<pk>\d+)$')
self.assertEqual(MacroUrlPattern('product/:product_pk').compiled, '^product/(?P<product_pk>\d+)$')
self.assertEqual(MacroUrlPattern('product/:pk/:product_pk').compiled,
'^product/(?P<pk>\d+)/(?P<product_pk>\d+)$')
self.assertEqual(MacroUrlPattern('product/:pk/:product_pk/:news_pk').compiled,
'^product/(?P<pk>\d+)/(?P<product_pk>\d+)/(?P<news_pk>\d+)$')

def test_slug(self):
self.assertEqual(MacroUrlPattern('page/:slug').compiled, '^page/(?P<slug>[\w-]+)$')
self.assertEqual(MacroUrlPattern('page/:category_slug/:slug').compiled,
Expand Down

0 comments on commit b2fac6f

Please sign in to comment.