django_project_demo/app/templates/user_edit_modelform.html
2024-08-24 03:25:23 +00:00

45 lines
1.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends 'layout.html' %}
{% load static %}
{#引入日期插件的css#}
{% block css %}
<link rel="stylesheet" href="{% static 'plugins/bootstrap-datepicker-1.9.0/bootstrap-datepicker.min.css' %}">
{% endblock %}
{% block content %}
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">编辑员工通过ModelForm组件生成</h3>
</div>
<div class="panel-body">
novalidate 关闭浏览器的表单验证用Django来控制检验
<form method="post" novalidate>
{% csrf_token %}
{% for field in form %}
<div class="form-group">
<label>{{ field.label }}</label><span style="color:red;"> {{ field.errors.0 }} {{field.error_messages}}</span>
{{ field }}
</div>
{% endfor %}
<button type="submit" class="btn btn-primary">保存</button>
</form>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script src="{% static 'plugins/bootstrap-datepicker-1.9.0/js/bootstrap-datepicker.min.js' %}"></script>
<script src="{% static 'plugins/bootstrap-datepicker-1.9.0/locales/bootstrap-datepicker.zh-CN.min.js' %}"></script>
<script>
$(function () {
$('#id_create_time').datepicker({
format: 'yyyy-mm-dd',
startDate: '0',
language: 'zh-CN',
autoclose: true,
});
})
</script>
{% endblock %}