最近,我添加了 adminplus,它会自动在管理页面上创建指向我的自定义 View 的链接。例如。 admin.site.register_view('somepath', 'My Fancy Admin View!', view=my_view)
应该生成一个“自定义 View ”菜单,其中包含名为“My Fancy Admin View!”的链接。如果我禁用 Grappelli,菜单和链接就会出现,但是当 Grappelli 启用时,菜单和链接就会消失。我的猜测是 Grappelli 跳过了这个菜单,因为它的定义与其他菜单不同。任何建议将不胜感激。
最佳答案
感谢 dan-klasson 提供的提示,我找到了解决我问题的方法
将以下代码添加到 Grappelli 的 admin/index.html
{% empty %}
<p>{% trans "You don´t have permission to edit anything." %}</p>
{% endfor %}
<!-- Code above is included as point of reference -->
<!-- Add the code below -->
<div class="grp-module" id="custom_views">
<h2>Custom Views</h2>
<div class="grp-row">
{% for path, name in custom_list %}
<a href="{{ path }}"><strong>{{ name }}</strong></a>
{% endfor %}
</div>
</div>
关于启用 grappelli 后,django adminplus 链接消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18093271/