Hi Tom,

I see what you meant. In the documentation (tutorial) namespacing is used
in the form example. Even with that in place, I am having trouble.

I did notice that I am not getting a 404 error instead, because the url
being built is dumplicated. Please see the trace below (errant line ibeing
#8):

 Using the URLconf defined in mysite.urls, Django tried these URL patterns,
in this order:

   1. ^$ [name='plant_refurbishment']
   2. ^about_us/$ [name='about_us']
   3. ^instrumentation_and_control/$ [name='instrumentation_and_control']
   4. ^machining/$ [name='machining']
   5. ^industrial_solutions/$ [name='industrial_solutions']
   6. ^trailer_refurbishment/$ [name='trailer_refurbishment']
   7. ^trailer_spares/$ [name='trailer_spares']
   8. ^contact_us/ ^$ [name='contact_us']
   9. ^admin/

The current URL, contact_us/contact_us/, didn't match any of these.


On Tue, Apr 9, 2013 at 4:43 PM, Sithembewena Lloyd Dube
<[email protected]>wrote:

> Thanks, Tom.
>
> I am not sure how you mean? In the contact_us app, I am not explicitly
> calling reverse. I only have the following:
>
> from django.shortcuts import render, reverse
>
> def contact_us(request):
>     return render(request, 'contact_us/contact_us.html')
>
>
>
>
> On Tue, Apr 9, 2013 at 4:22 PM, Tom Evans <[email protected]>wrote:
>
>> On Tue, Apr 9, 2013 at 2:31 PM, Sithembewena Lloyd Dube
>> <[email protected]> wrote:
>> > Hi everyone,
>> >
>> > I have a project based on the latest Django version (1.5.1.) where I
>> created
>> > a contact_us application. The project has a urls.py file with some url
>> > patterns. The contact_us app implements its own urls.py file
>> (decoupling).
>> > In the project's urls.py file (just above the admin site's url
>> pattern), i
>> > have the following url pattern:
>> >
>> > url(r'^contact_us/', include('contact_us.urls',
>> namespace="contact_us")),
>> >
>> > and in the contact_us app's urls.py file, I have the following url
>> pattern:
>> >
>> > urlpatterns = patterns('',
>> >     url(r'^$', views.contact_us, name='contact_us'),
>> > )
>> >
>> > In a template residing in the contact_us app's own templates folder, I
>> use
>> > the url template tag as follows:
>> >
>> > <a href="{% url 'contact_us' %}">Contact Us</a>
>> >
>> > resulting in the following exception:
>> >
>> > NoReverseMatch at /contact_us/
>> >
>> > Reverse for 'contact_us' with arguments '()' and keyword arguments '{}'
>> not
>> > found.
>> >
>> > Any ideas what I could be missing? I namespaced the contact_us urls
>> include
>> > in the main urls'py file and there is a simple contact_us view in the
>> > contact_us app which renders an existing template.
>> >
>> > Thanks.
>>
>> You've omitted the namespace when reversing the url. Use
>> 'contact_us:contact_us'.
>>
>> Cheers
>>
>> Tom
>>
>> --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
> --
> Regards,
> Sithu Lloyd Dube
>



-- 
Regards,
Sithu Lloyd Dube

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to