Can't change URL match in Admin Changeform
I read a lot of docs, tried everything and still can't figure out why my template is returning Reverse for '' with arguments '(1,)' and keyword arguments '{}' no error found. Please see the error dump here: http://dpaste.com/721187/
The tag I'm using in the change_form.html template is {% url pdfview 1%}
The FVatAdmin class (admin.ModelAdmin) has a get_urls method that looks like this:
def get_urls(self):
urls = super(FVatAdmin, self).get_urls()
my_urls = patterns('',
url(r'^view/(?P<id>\d+)', self.admin_site.admin_view(self.pdf_view), name="pdfview"),
url(r'^js/calculate', self.admin_site.admin_view(self.calculate), name="calc"),
)
return my_urls + urls
The above url and pdfview work fine, but a few are not resolved with {% url pdfview 1%} in the template and through reverse ('pdfview', args = {1}) in the view or through the wrapper.
I just don't understand what I am doing wrong. I'm new to Django ... HELP :)
source to share
Django admin namespaced urls to avoid clashing with other urls.
Try the following {% url admin: pdfview 1%}
See below for details:
https://docs.djangoproject.com/en/1.4/topics/http/urls/#topics-http-reversing-url-namespaces
source to share