Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django-Grappelli: Reverse for 'grp_related_lookup' with arguments '()' and keyword arguments '{}' not found

I use django-grappelli to create orderable inlines on the admin site. Occasionally (not reproducibly - about 50% of the time, which is particularly weird), Django throws the following exception when I try to save the ordering from the inline:

 Exception Type: NoReverseMatch
 Exception Value: Reverse for 'grp_related_lookup' with arguments '()' and keyword arguments '{}' not found.
 Exception Location: /usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py in render, line 424

The offending line is this:

 $("#id_" + this).grp_related_fk({lookup_url:"{% url 'grp_related_lookup' %}"});

As per the advice given in this related thread, I've tried quickly testing it in the shell, but it seems to work fine:

>>> from django.core.urlresolvers import reverse
>>> print reverse('grp_related_lookup')
/grappelli/lookup/related/

I'm at a loss. Has anyone made a similar experience?

Django version is 1.5.1.

like image 418
principal Avatar asked Aug 19 '13 18:08

principal


1 Answers

You probably forgot to add grappelli urls into your urls.py (at least it was the case for me)

url(r'^grappelli/', include('grappelli.urls')),
like image 186
Emma Avatar answered Sep 30 '22 16:09

Emma