Changes between Initial Version and Version 1 of Ticket #17716


Ignore:
Timestamp:
Mar 4, 2012, 4:00:10 AM (13 years ago)
Author:
Aymeric Augustin
Comment:

Fixed formatting (please use preview).

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17716 – Description

    initial v1  
    1 When we register urls - we can specify app_name like this
     1When we register urls - we can specify `app_name` like this
    22
     3{{{
    34urlpatterns = patterns('',
    45    url(r'^inventory/', include('inventory.urls', app_name='inventory')),
    56    url(r'^cart/', include('cart.urls',app_name='cart')),
     7}}}
    68
    7 Then we can use reverse method or {% url cart:cart  %} to generate url.
     9Then we can use `reverse` method or `{% url cart:cart  %}` to generate url.
    810
    9 But it does not work - ''got NoReverseMatch at /cart/
     11But it does not work
     12
     13{{{
     14got NoReverseMatch at /cart/
    1015
    1116u'cart' is not a registered namespace
     
    1318Request URL:    http://localhost:8000/cart/
    1419Django Version: 1.4a1
    15 ''
     20}}}
    1621
    1722When I register urls like this
    1823
     24{{{
    1925    url(r'^inventory/', include('inventory.urls', namespace='inventory')),
    2026    url(r'^cart/', include('cart.urls',namespace='cart')),
     27}}}
    2128
    2229IT DOES WORK !
     
    2431According to documentation format for urls should be
    2532
    26 {% url app_name:view_name  %}
     33`{% url app_name:view_name  %}`
     34
    2735but actual format is
    28 {% url namespace:view_name  %}
     36
     37`{% url namespace:view_name  %}`
    2938
    3039I think this is a bug
    3140 
     41The source of bug may be in
     42file `/usr/local/lib/python2.7/site-packages/django/conf/urls/__init__.py`
     43function `include(arg, namespace=None, app_name=None)`
    3244
     45It returns `tuple (urlconf_module, app_name, namespace)`
    3346
    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)
     47It looks like it should be `(urlconf_module, namespace, app_name) `
Back to Top