django使用inclusion_tag标签封装数据字典
2016-03-30 00:48
375 查看
Django_DictSelect
使用inclusion_tag标签封装数据字典最近用java做一个评估系统时,填报系统的前台页面经常用到数据字典(模板标签封装select),于是产生了在django系统下实现这个功能的想法,原理很简单,使用django的inclusion_tag封装select
代码下载:https://github.com/pushiqiang/Django_DictSelect.git
设置:
1.将DataDict加入settingsINSTALLED_APPS = ( ... 'DataDict', ... )
2.在后台admin添加字典
3.在前台模板中调用
模板中调用:
{% load DictSelect %}<br> {% DictSelect dictcode='cadeYear' [name='s01'] [id='s01'] [class=''] [value=''] %}<br>
其中方括号为选填。
example:
字典:学年 字典编码:cadeYear 字典值:2011-2011 2011-2012 2012-2013调用:{% DictSelect dictcode=’cadeYear’ id=’s01’ name=’s01’ %}
效果:
![](https://raw.githubusercontent.com/pushiqiang/Django_DictSelect/master/demo/dict_1.jpg)
![](https://raw.githubusercontent.com/pushiqiang/Django_DictSelect/master/demo/dict_2.jpg)
相关文章推荐
- GDAL库学习笔记(1):无缝拼接Google卫星图
- UVa 11292 Dragon of Loowater
- Go语言学习四:函数和类
- uva11292-Dragon of Loowater
- Django文件下载,解决Django中文名问题
- [SIMD]单指令多数据指令集(二)—— SIMD指令集在非对称算法中的应用
- Go语言学习三 :循环语句
- golang 获取exe、dll、apk 版本号
- UVA 11090 Going in Cycle!!
- Go语言学习二 :常数和条件语句
- Codeforces 658 C. Bear and Forgotten Tree 3(树的构造)
- tinyos之 fan out( but there is no combine function specified for ***)
- 【Algorithm】插入排序法
- Go语言学习一 :基础语句
- Google文件系统(转自维基百科)
- 使用Google语音识别引擎(Google Speech API)
- mongo 主从
- uva11090Going in Cycle!!【bellman二分判负环】
- codeforces 658C Bear and Forgotten Tree 3构造-多么痛的领悟
- Django表单API