mirror of https://github.com/snachodog/mybuddy.git
Implement example Bootstrap 4 styled form in Baby Add form.
This commit is contained in:
parent
3d90a21144
commit
12e700eb74
|
@ -1,12 +1,28 @@
|
||||||
{% extends 'core/base.html' %}
|
{% extends 'core/base.html' %}
|
||||||
|
{% load i18n widget_tweaks %}
|
||||||
|
|
||||||
{% block title %}Add a Baby{% endblock %}
|
{% block title %}Add a Baby{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Add a Baby</h1>
|
<h1>Add a Baby</h1>
|
||||||
<form method="POST" class="post-form">
|
<form role="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{% for field in form %}
|
||||||
<button type="submit" class="save btn btn-default">Save</button>
|
<div class="form-group">
|
||||||
|
<label for="id_{{ field.name }}">{{ field.label }}</label>
|
||||||
|
{% if field.errors %}
|
||||||
|
{{ field|attr:"class:form-control is-invalid" }}
|
||||||
|
{% else %}
|
||||||
|
{{ field|attr:"class:form-control" }}
|
||||||
|
{% endif %}
|
||||||
|
{% if field.help_text %}
|
||||||
|
<p class="help-block"><small>{{ field.help_text }}</small></p>
|
||||||
|
{% endif %}
|
||||||
|
{% if field.errors %}
|
||||||
|
<p class="invalid-feedback">{% for error in field.errors %}{{ error }}{% endfor %}</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
<button type="submit" class="btn btn-primary">{% trans "Submit" %}</button>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue