2020
10-08
10-08
django filter过滤器实现显示某个类型指定字段不同值方式
1,前端样式2,html代码{%loadasset_filter%}<divclass="col-sm-2"><selectclass="input-smform-controlselect2inline"name="ServiceModel"><optionvalue="">模块</option>{%foriin'Ecs'|ecs_model_field_distinct:'ServiceModel'%}{%ifi.0%}<optionvalue="{{i.0}}">{{i.0}}</option>{%endif%}{%endfor%}</select></div>3,后端代码asset_filter.py内容如下:@register.filter(name='ecs_mode...
继续阅读 >