You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.7 KiB
68 lines
2.7 KiB
zz
|
|
[[[[{% extends 'base.html' %}
|
|
|
|
{% block content %}
|
|
<div class="container">
|
|
<h2 class="text-center mb-4">创建药品</h2>
|
|
<form method="POST" class="needs-validation" novalidate>
|
|
{% csrf_token %}
|
|
|
|
<div class="form-group">
|
|
<label for="id_name">名称</label>
|
|
<input type="text" class="form-control" id="id_name" name="name" placeholder="药品名称"/>
|
|
<div class="invalid-feedback">请输入药品名称。</div>
|
|
<!-- 正确显示name字段的错误信息 -->
|
|
{% if form.name.errors %}
|
|
<ul class="errorlist text-danger">
|
|
{% for error in form.name.errors %}
|
|
{{ error }}
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- 描述字段修正为文本区域 -->
|
|
<div class="form-group">
|
|
<label for="id_description">描述</label>
|
|
<textarea class="form-control" id="id_description" name="description" rows="3" placeholder="药品描述..."></textarea>
|
|
<div class="invalid-feedback">请输入药品名称。</div>
|
|
{% if form.description.errors %}
|
|
<ul class="errorlist text-danger">
|
|
{% for error in form.description.errors %}
|
|
{{ error }}
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- 价格字段 -->
|
|
<div class="form-group">
|
|
<label for="id_price">价格</label>
|
|
<input type="number" step="0.01" class="form-control" id="id_price" name="price" placeholder="价格" />
|
|
<div class="invalid-feedback">请输入药品价格。</div>
|
|
</div>
|
|
{% if form.price.errors %}
|
|
<ul class="errorlist text-danger">
|
|
{% for error in form.price.errors %}
|
|
{{ error }}
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
<!-- 库存字段 -->
|
|
<div class="form-group">
|
|
<label for="id_stock">库存</label>
|
|
<input type="number" class="form-control" id="id_stock" name="stock" placeholder="库存数量" />
|
|
<div class="invalid-feedback">请输入药品库存数量。</div>
|
|
{% if form.stock.errors %}
|
|
<ul class="errorlist text-danger">
|
|
{% for error in form.stock.errors %}
|
|
{{ error }}
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">保存更改</button>
|
|
<button href="medicine/list/" class="btn btn-primary">返回列表</button>
|
|
</form>
|
|
</div>
|
|
{% endblock %} |