Thanks,

My edit license URL is:

    url(r'^license/edit/(?P<license_id>\d+)/$', views.edit_license, name=
'edit_license'),

However, this is what I want and it has been this way for years. My URLs 
are organised:

/<app_name>/<resource_name>/

I don't think this explains why my URLs are all namespaced when I haven't 
changed my code and my code doesn't use namespaces. I'm really confused. :)

Thanks again
Mike





On Thursday, 21 December 2017 11:38:42 UTC-5, Andréas Kühne wrote:
>
> Ok,
>
> You have not namespaced anything, but you have added the api name infront 
> of the URLs you are adding.
>
> So for example, I am guessing that you in your urls.py file for the 
> license app have added "/license/edit/<license_id>/" for the license 
> detail page? Because you have already added the license part with the 
> prefix you have added here:
>
> for app in settings.SITE_APPS.get_application_list():    
>     url_prefix = r'^%s/' % app
>         urlpatterns += [
>             url(prefix, include(url_include)),
>
>         ]
>
>
> So you have added license twice, and therefore you will need to add it 
> twice when you call the urls as well.
>
> You should probably do this instead:
> for app in settings.SITE_APPS.get_application_list():    
>     url_prefix = r'^%s/' % app
>         urlpatterns += [
>             url('', include(url_include)),
>
>         ]
>
>
>
> If you don't want that extra license part.
>
> Namespace is added the way you suggested via:
> url('', include(url_include, namespace="license"))
>
> Also, it doesn't result in an extra app part (in this case license), it 
> only adds the namespace in the call to reserve, so if you had setup the 
> namespace like i wrote here, you would use: 
> reverse("license:license_detail", args=(1, ))
>
> Hope I have explained it good enough :-)
>
> Regards,
>
> Andréas
>
> 2017-12-21 17:02 GMT+01:00 Stodge <sto...@gmail.com <javascript:>>:
>
>> I am using a prefix when I include the URLs for each app:
>>
>> for app in settings.SITE_APPS.get_application_list():    
>>     url_prefix = r'^%s/' % app
>>         urlpatterns += [
>>             url(prefix, include(url_include)),
>>
>>         ]
>>
>> I just assumed this isn't using namespaces because I'm not using the 
>> namespace parameter on include()?
>>
>>
>>
>> On Thursday, 21 December 2017 10:38:36 UTC-5, Stodge wrote:
>>>
>>> I am porting an app from Django 1.6.x to 1.10.x and I'm hitting a 
>>> problem with URL namespaces. I don't specifically configure any namespaces 
>>> in my URLs but Django seems to think that all my app URLs are namespaced. 
>>> The documentation seems to imply that namespaces are optional and only 
>>> configured if provided, but my experience suggests otherwise. Would someone 
>>> be able to confirm if namespaces are optional (opt-in)? I'm really rather 
>>> confused at the moment about this. Thanks
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com <javascript:>.
>> To post to this group, send email to django...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/b471c11c-2d33-4f47-83a2-36209edd4ea0%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/b471c11c-2d33-4f47-83a2-36209edd4ea0%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6e29c8fd-f13d-4281-a047-622dc8868147%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to