Django管理弹出功能 [英] Django Admin popup functionality
问题描述
这个主题很常见(这里最明确的说明是: http:// www.hoboes.com/Mimsy/hacks/replicating-djangos-admin/ ),但我仍然遇到麻烦。我正在尝试使用管理站点中使用的加号按钮功能,可以在链接的条目中添加一个附加的外键。在管理员网站中,弹出式窗口显示允许用户提交一个新的字段,然后新的值填充在原始表单上。
This topic is fairly common (most explicitly detailed here: http://www.hoboes.com/Mimsy/hacks/replicating-djangos-admin/), but I'm still having trouble with it. I'm trying to use the "plus" button functionality used in the admin site where one can add an additional foreign key to a linked entry. In the admin site, a popup displays allowing the user to submit a new field and then that new value is populated on the original form.
我认为我的问题集中在在base.html模板和popadd.html模板中包含以下行:
I think my issue centers around the inclusion of this line:
单击加号按钮不会弹出一个新窗口。 popadd模板只是加载在同一个选项卡中。并且提交新条目不会使用户回到原始表单。
within the base.html template and the popadd.html template. Clicking the plus button does not bring up a new window. The popadd template simply loads in the same tab. And submitting a new entry does not take the user back to the original form.
管理站点功能正常。我在settings.py文件中包含ADMIN_MEDIA_PREFIX ='/ media / admin /'。它与RelatedObjectLookups.js的位置有关吗?它目前位于我的项目文件夹外的管理目录。我必须创建一个符号链接吗?
The admin site is functional. I am including ADMIN_MEDIA_PREFIX = '/media/admin/' in the settings.py file. Does it have something to do with where the RelatedObjectLookups.js lives? It's currently in an admin directory outside of my project folder. Do I have to create a symlink?
抱歉的noob问题。感谢任何建议(尽可能详细)。
Sorry for the noob questions. Would appreciate any suggestions (as detailed as possible).
推荐答案
我还创建了一个可以包含在您的项目中的应用程序 http://github.com/sontek/django-tekextensions
I've also created an app you can just include in your project at http://github.com/sontek/django-tekextensions
这篇关于Django管理弹出功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!