跳转到主要内容

用于 https://github.com/anutron/behavior 与 django 集成的实用工具。

项目描述

https://github.com/anutron/behavior 与 django 集成提供实用工具。

此应用程序提供模板过滤器,可以更改行为所需表单字段的属性。它还包含用于与 django.contrib.staticfiles 一起使用的 'behavior' 和 'behavior-more' 库。

许可证是 MIT。

安装

pip install django-mootools-behavior

配置

  1. 将 'mootools_behavior' 添加到 INSTALLED_APPS;

  2. (可选) 运行 python manage.py collectstatic 以获取 'behavior' JavaScript 文件;

  3. 将必要的 js 包含到 html 中,并使用提供的模板过滤器设置表单元素的属性。

过滤器

behave

将 'data-behavior-…' 属性设置到表单字段

{% load mootools_behavior %}

<!-- data-behavior:"OverText" will be added to input field -->
{{ form.title|behave:"OverText" }}

set_data

设置 HTML5 数据属性 ( http://ejohn.org/blog/html-5-data-attributes/ )。

示例

{% load mootools_behavior %}

<!-- data-behavior:"OverText" will be added to input field -->
{{ form.title|set_data:"behavior:OverText" }}

贡献

如果您发现了一个错误,实现了一个功能或有建议,请随时与我联系,提交一个问题或发送一个拉取请求。

源代码

报告错误

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。

源代码分发

django-mootools-behavior-0.1.1.tar.gz (17.3 kB 查看哈希值)

上传时间 来源

支持