zoukankan      html  css  js  c++  java
  • 使用插件和不使用插件实现select的框

       # 1、select框单选
        # 方式1
        select1 = fields.ChoiceField(
            choices=[
                (1,"select框方式1_1"),
                (2,"select框方式1_2"),
                (3,"select框方式1_3")
            ],
            initial=1,
            label="select框方式1",
            label_suffix="--->",
            widget=widgets.Select
        )
        # 方式2
        select2 = fields.CharField(
            initial=1,
            label="select框方式2",
            label_suffix="--->",
            widget=widgets.Select(
                choices=[
                    (1, "select框方式2_1"),
                    (2, "select框方式2_2"),
                    (3, "select框方式2_3")
                ]
            )
        )
        # select框多选
        # 方式3
        select3 = fields.CharField(
            initial=[1,2],
            label="select框方式3",
            label_suffix="--->",
            widget=widgets.SelectMultiple(
                choices=[
                    (1, "select框方式3_1"),
                    (2, "select框方式3_2"),
                    (3, "select框方式3_3")
                ]
            )
        )
    
        # 方式4
        select4 = fields.MultipleChoiceField(
            initial=[1,2],
            label="select框方式4",
            label_suffix="--->",
            choices=[
                    (1, "select框方式4_1"),
                    (2, "select框方式4_2"),
                    (3, "select框方式4_3")
                ]
        )
        #2、Radio框
        # 方式1
        radio1 = fields.CharField(
            initial=1,
            label="Radio框方式1",
            label_suffix="--->",
            widget=widgets.RadioSelect(
                choices=[
                    (1, "Radio框方式1_1"),
                    (2, "Radio框方式1_2"),
                    (3, "Radio框方式1_3")
                ]
            )
        )
        # 方式2
        radio2 = fields.ChoiceField(
            initial=1,
            label="Radio框方式2",
            label_suffix="--->",
            choices=[
                    (1, "Radio框方式2_1"),
                    (2, "Radio框方式2_2"),
                    (3, "Radio框方式2_3")
                ],
            widget=widgets.RadioSelect
        )
        #3、checkbox框
        # 方式1
        check1 = fields.ChoiceField(
            choices=[
                (1, "checkbox框框方式1_1"),
                (2, "checkbox框框方式1_2"),
                (3, "checkbox框框方式1_3")
            ],
            initial=[1,2],
            label_suffix="--->",
            label="checkbox框方式1",
            widget=widgets.CheckboxSelectMultiple
        )
    
        # 方式2
    
        check2 = fields.CharField(
            initial=[1,2],
            label="checkbox框方式2",
            label_suffix="--->",
            widget=widgets.CheckboxSelectMultiple(
                choices=[
                    (1, "checkbox框框方式2_1"),
                    (2, "checkbox框框方式2_2"),
                    (3, "checkbox框框方式2_3")
                ],
            )
    
        )
    

      

    页面效果

  • 相关阅读:
    【原创】解决向工程中添加Megacore 文件在文件列表中没有出现目标文件的问题
    (笔记)找工作,该怎么进补
    (原创)结构体位域操作
    (原创)TCP/IP学习笔记之IP(网际协议)
    (原创)确认大端模式或小端模式(最直接有效的方法)
    (原创)HDL中的unsigned与signed
    (原创)TCP/IP学习笔记之概述
    (笔记)往一个指定的地址读写一个值
    (笔记)我的EDN博客被评为专家博客啦
    (原创)同步复位与异步复位
  • 原文地址:https://www.cnblogs.com/bainianminguo/p/9298229.html
Copyright © 2011-2022 走看看