reverse url of admin list

1,209 views
Skip to first unread message

Marc Aymerich

unread,
Oct 12, 2010, 7:39:21 AM10/12/10
to django...@googlegroups.com
I'm trying to find out what is the reverse url sentence for the "admin list" of a specific model of an app. Suppose that we have an app called 'invoice' and this has a model also called 'invoice'. I want to get this url: "/admin/invoice/invoice" via reverse function. Something like : 

>>> reverse('admin:invoice_invoice_add')
'/admin/invoice/invoice/add/'

but with expected reverse('admin:invoice_invoice') it doesn't work :(

>>> reverse('admin:invoice_invoice')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py", line 390, in reverse
    *args, **kwargs)))
  File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py", line 336, in reverse
    "arguments '%s' not found." % (lookup_view_s, args, kwargs))
NoReverseMatch: Reverse for 'invoice_invoice' with arguments '()' and keyword arguments '{}' not found.

Any idea?


--
Marc

Sævar Öfjörð

unread,
Oct 12, 2010, 1:46:23 PM10/12/10
to Django users
It's called 'changelist'

So you should call reverse('admin:invoice_invoice_changelist')

-Sævar

Marc Aymerich

unread,
Oct 12, 2010, 1:57:43 PM10/12/10
to django...@googlegroups.com
On Tue, Oct 12, 2010 at 7:46 PM, Sævar Öfjörð <saev...@gmail.com> wrote:
It's called 'changelist'

So you should call reverse('admin:invoice_invoice_changelist')

Wow Sævar, thank you very much!

--
Marc
Reply all
Reply to author
Forward
0 new messages