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

django, django-grappelli, python

Solution

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')),

Problem

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.

Original source

Related problems