首页 > 其他分享 >25 bootstrap--v3--datetimepicker时间选择器--应用

25 bootstrap--v3--datetimepicker时间选择器--应用

时间:2022-09-28 17:46:24浏览次数:60  
标签:25 -- class forms html DateTimePickerInput 选择器

在模板中引用响应的文件

比如:
layout.html

<link rel="stylesheet" href="{% static 'stark/plugins/datetimepicker/css/bootstrap-datetimepicker.css' %} "/>
<script src="{% static 'stark/plugins/datetimepicker/js/bootstrap-datetimepicker.js' %} "></script>
<script src="{% static 'stark/plugins/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js' %} "></script>

在自己modelform中;

from django import forms

class DateTimePickerInput(forms.TextInput):
    template_name = 'stark/forms/widgets/datetime_picker.html'


class ClassListModelForm(StarkModelForm):
    class Meta:
        model = models.ClassList
        fields = '__all__'
        widgets = {
            'start_date': DateTimePickerInput,
            'graduate_date': DateTimePickerInput,
        }

datetime_picker.html

<div class="input-group date form_date">
    <input readonly class="form-control" type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value != None %}
           value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} />
    <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>

标签:25,--,class,forms,html,DateTimePickerInput,选择器
From: https://www.cnblogs.com/mimiICC/p/16696087.html

相关文章

  • geoserver 安装
    下载满足要求的geoserverdockerpullkartoza/geoserver:2.21.1自定义用户密码启动docker,数据路径按需求挂载出来/opt/geoserver/data_dirdockerrun--namege......
  • error CS8773: "Feature 'global using directive' is not available in C# 9.0" afte
    errorCS8773:"Feature'globalusingdirective'isnotavailableinC#9.0"afterdowngradefromnet6.0tonet5.0回答1remove<ImplicitUsings>enable</Implici......
  • 程序员修炼之道—从小工到专家(一)
    第一章——注重实效的哲学(上)1.我的源码让猫给吃了出现了未曾预见到的问题,要设法尽可能职业地处理它们,可以为自己的能力自豪,同时对于无知和错误必须诚实面对。对于不可能......
  • VMWare Workstation安装Ghost版系统
    新建虚拟机的教程可以参考安装纯净版系统的教程,这里不再赘述,下面主要看下与安装纯净版系统的不同之处。如果我们直接启动,会报错networkbootfromamd79c978a,如下图 ......
  • Maven-私服搭建与配置
    一、maven私服搭建1.下载地址https://help.sonatype.com/repomanager3/product-information/download/download-archives---repository-manager-32.启用tar-zxvfnexu......
  • 使用Linux命令sort及uniq对文件或屏幕输出进行分组统计
    【转载】:https://blog.51cto.com/hanzhichao/3436177  在日常Linux操作常常需要对一些文件或屏幕数次中重复的字段进行分组统计。另外分组统计也是常考的面试题之一。......
  • 爱心
    #include<stdio.h>#include<stdlib.h>#include<windows.h>intmain(){floatx,y,a;for(y=1.5;y>-1.5;y-=0.1){for(x=-1.5;x<1.5;x+=0.05)......
  • JS实现数组元素位置交换
    /***数组元素交换位置*@param{array}arr数组*@param{number}index1添加项目的位置*@param{number}index2删除项目的位置*index1和index2分别是两......
  • CSS实现按钮点击时缩小后放大的效果
    #down_button_android{width:100%;transition:transform0.3s;}#down_button_android:active{t......
  • 实验2:Open vSwitch虚拟交换机实践与实验环境安装配置
    实验2:OpenvSwitch虚拟交换机实践一、实验目的能够对OpenvSwitch进行基本操作;能够通过命令行终端使用OVS命令操作OpenvSwitch交换机,管理流表;能够通过Mininet的Pytho......