Changes between Initial Version and Version 1 of Ticket #17716
- Timestamp:
- Mar 4, 2012, 4:00:10 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #17716 – Description
initial v1 1 When we register urls - we can specify app_namelike this1 When we register urls - we can specify `app_name` like this 2 2 3 {{{ 3 4 urlpatterns = patterns('', 4 5 url(r'^inventory/', include('inventory.urls', app_name='inventory')), 5 6 url(r'^cart/', include('cart.urls',app_name='cart')), 7 }}} 6 8 7 Then we can use reverse method or {% url cart:cart %}to generate url.9 Then we can use `reverse` method or `{% url cart:cart %}` to generate url. 8 10 9 But it does not work - ''got NoReverseMatch at /cart/ 11 But it does not work 12 13 {{{ 14 got NoReverseMatch at /cart/ 10 15 11 16 u'cart' is not a registered namespace … … 13 18 Request URL: http://localhost:8000/cart/ 14 19 Django Version: 1.4a1 15 '' 20 }}} 16 21 17 22 When I register urls like this 18 23 24 {{{ 19 25 url(r'^inventory/', include('inventory.urls', namespace='inventory')), 20 26 url(r'^cart/', include('cart.urls',namespace='cart')), 27 }}} 21 28 22 29 IT DOES WORK ! … … 24 31 According to documentation format for urls should be 25 32 26 {% url app_name:view_name %} 33 `{% url app_name:view_name %}` 34 27 35 but actual format is 28 {% url namespace:view_name %} 36 37 `{% url namespace:view_name %}` 29 38 30 39 I think this is a bug 31 40 41 The source of bug may be in 42 file `/usr/local/lib/python2.7/site-packages/django/conf/urls/__init__.py` 43 function `include(arg, namespace=None, app_name=None)` 32 44 45 It returns `tuple (urlconf_module, app_name, namespace)` 33 46 34 The source of bug may be in 35 36 file /usr/local/lib/python2.7/site-packages/django/conf/urls/__init__.py 37 function include(arg, namespace=None, app_name=None) 38 39 It returns tuple (urlconf_module, app_name, namespace) 40 It looks like it should be (urlconf_module, namespace, app_name) 47 It looks like it should be `(urlconf_module, namespace, app_name) `