Django的简单模式面板
django-facebox的Python项目详细描述
安装
pip install django-facebox
外部依赖性
- jquery—包中不包括此项,因为在大多数情况下,预计此项已经可用。
设置
将facebox添加到INSTALLED_APPS:
INSTALLED_APPS+=('facebox',)
确保有django.template.context_processors.request处理器
TEMPLATES=[{...'OPTIONS':{'context_processors':[...'django.template.context_processors.request',],},},]
只包括facebox模板
{%include"facebox/facebox_css.html"%}{# Before the closing head tag #}{%include"facebox/facebox_js.html"%}{# Before the closing body tag #}
在生产服务器上部署时,不要忘记运行:
python manage.py collectstatic
用法
扩展ajax请求的基本模板
{%extendsrequest.is_ajax|yesno:"facebox/base.html,base.html"%}
将rel="facebox"添加到链接中,并将其设置为要显示的页
<ahref="{%url'remote.html'%}"rel="facebox">Click here</a>
请参阅example应用程序。此应用程序用于手动测试此包的功能。这也是一个很好的例子。
你只需要django 1.4或更高版本就可以运行它。它可能在旧版本上运行,但未经测试。
许可证
django-facebox是根据bsd许可证发布的。