Hi Boyombo,
The error I get when using {% url customer_edit customer.id %} is:
NoReverseMatch at /customer/2
Reverse for 'customer_edit' with arguments '(2L,)' and keyword arguments
'{}' not found.
# The project url.py:
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^', include('djapp.myapp.urls')),
# The app url.py:
from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('djapp.myapp.views',
(r'^$', 'main'),
(r'^test/$', 'test'),
(r'^docs/$', 'documentation'),
(r'^mgmt/$', 'management'),
# Customers
(r'^customer/$', 'customer_list'),
(r'^customer/(?P<customer_id>\d+)$', 'customer_detail'),
(r'^customer/add$', 'customer_add'),
(r'^customer/(?P<customer_id>\d+)/edit$', 'customer_edit'),
(r'^customer/(?P<customer_id>\d+)/delete$', 'customer_delete'),
-- snip --
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),
)
Thanx a lot.
Regards,
Gerard.
boyombo wrote:
> Hi Gerard,
>
> can you what is your url conf like and the error message you get?
>
> On Oct 17, 10:10 am, Gerard <[email protected]> wrote:
>> Hi All,
>>
>> I've been trying to figure out why this works:
>>
>> {% url project.myapp.views.customer_edit customer.id %}
>>
>> And this does not:
>>
>> {% url customer_edit customer.id %}
>>
>> I could go for url() in my patterns and decouple view and pattern name, but
>> is it not possible to tell the template loader (?) where to look for views?
>>
>> Feels like it just needs an import statement on the right place.
>>
>> NB: I tried passing views in patterns as strings and methods.
>>
>> Please advice.
>>
>> Kind regards,
>>
>> Gerard.
>>
>> --
>> self.url =www.gerardjp.com
> >
--
self.url = www.gerardjp.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---