gpt4 book ai didi

python - Django-Grappelli:使用参数 'grp_related_lookup' 和关键字参数 '()' 找不到 '{}' 的反向

转载 作者:太空狗 更新时间:2023-10-29 17:39:04 25 4
gpt4 key购买 nike

我使用 django-grappelli 在管理站点上创建可订购的内联。偶尔(不可重现 - 大约 50% 的时间,这特别奇怪),当我尝试从内联中保存顺序时,Django 会抛出以下异常:

 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

违规行是这样的:

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

根据 this related thread 中给出的建议,我已经尝试在 shell 中快速测试它,但它似乎工作正常:

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

我很迷茫。有没有人有过类似的经历?

Django 版本是 1.5.1。

最佳答案

您可能忘记将 grappelli url 添加到您的 urls.py 中(至少对我来说是这样)

url(r'^grappelli/', include('grappelli.urls')),

关于python - Django-Grappelli:使用参数 'grp_related_lookup' 和关键字参数 '()' 找不到 '{}' 的反向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18321026/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com