django的简单fancybox模式

django-fancybox的Python项目详细描述


这是FancyboxDjango集成。

https://img.shields.io/pypi/v/django-fancybox.svghttps://img.shields.io/pypi/dm/django-fancybox.svghttps://img.shields.io/github/license/bashu/django-fancybox.svg

安装

pip install django-fancybox

外部依赖性

  • jquery—包中不包括此项,因为在大多数情况下,预计此项已经可用。

设置

fancybox添加到INSTALLED_APPS

INSTALLED_APPS+=('fancybox',)

确保有django.template.context_processors.request处理器

TEMPLATES=[{...'OPTIONS':{'context_processors':[...'django.template.context_processors.request',],},},]

只包括fancybox模板

{%include"fancybox/fancybox_css.html"%}{# Before the closing head tag #}{%include"fancybox/fancybox_js.html"%}{# Before the closing body tag #}

在生产服务器上部署时,不要忘记运行:

python manage.py collectstatic

用法

扩展ajax请求的基本模板

{%extendsrequest.is_ajax|yesno:"fancybox/base.html,base.html"%}

class="fancybox"添加到链接中,并将其设置为要显示的页

<adata-fancyboxdata-type="ajax"href="{%url'remote.html'%}"class="fancybox">Click here</a>

请参阅example应用程序。此应用程序用于手动测试此包的功能。这也是一个很好的例子。

你只需要django 1.4或更高版本就可以运行它。它可能在旧版本上运行,但未经测试。

许可证

django-fancybox是根据bsd许可证发布的。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Clojure关键字在内存中的大小是多少?   Java中有固定长度的通用数组对象吗?   PostgreSQL:通过Java更新我的用户表   错误:使用java解析xml   java Json显示列表中对象的名称   java比较JodaTime时区   与JAVA中的API和包的区别?   java的int值在for循环中不改变   谷歌应用引擎中的java RSA   迁移到spring 5后出现java非法字符错误   java Websphere管理控制台不工作   JavaGSON如何始终在json中包含毫秒?   带有空格和双引号的windows Java ProcessBuilder命令参数失败   java错误:重复的zip条目[43.jar:org/apache/http/annotation/NotThreadSafe.class]