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.


Reply via email to