为什么要添加“添加其他内容”升级到1.6时,按钮从Django内联中消失了吗? [英] Why has the "Add another" button disappeared from my django inlines when upgrading to 1.6?

查看:71
本文介绍了为什么要添加“添加其他内容”升级到1.6时,按钮从Django内联中消失了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在django网站上的管理界面中有很多内联。在我使用的先前版本的django上,有一个添加另一个按钮来添加更多条目。我升级到django 1.6,此按钮消失了。这是我的admin.py的相关部分:

I have a django site with lots of inlines in the admin interface. On the previous version of django that I was using, there was an "Add another" button to add more entries. I upgraded to django 1.6 and this button has disappeared. Here is the relevant part of my admin.py:

class MyInline(admin.TabularInline):
  extra = 0

请注意extra = 0,因为我不想显示任何东西,除非实际有一个或多个

Note that extra = 0 because I don't want to display anything unless there actually is one or more entry.

我还尝试根据看到的一些帖子添加max_num = 9999,但这无济于事。

I also tried adding max_num = 9999, based on some posts I saw, but that didn't help.

我了解添加另一个按钮是使用JavaScript实现的。谁能解释为什么添加另一个按钮消失了,更重要的是,我能做些什么来找回它?

I understand the "Add another" button is implemented with JavaScript. Can anyone explain why the "Add another" button has gone, and more importantly, what I can to do get it back?

非常感谢。

推荐答案

原来,问题是由于从项目的早期版本(从Django的早期版本)复制静态管理文件引起的。从当前版本复制了静态管理文件后,添加其他按钮将返回。

It turned out that the problem was caused by copying the static admin files from the previous version of my project (from an earlier version of django). Once I recopied the static admin files from the current version, the "Add another" buttons are back.

这篇关于为什么要添加“添加其他内容”升级到1.6时,按钮从Django内联中消失了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆