first commit
This commit is contained in:
55
templates/autoapp/add_auto.html
Normal file
55
templates/autoapp/add_auto.html
Normal file
@@ -0,0 +1,55 @@
|
||||
{% block content %}
|
||||
<div class="container mt-5">
|
||||
<h2>Добавить автомобиль</h2>
|
||||
|
||||
{% if messages %}
|
||||
<div class="mt-3">
|
||||
{% for message in messages %}
|
||||
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
|
||||
{{ message }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" class="mt-4">
|
||||
{% csrf_token %}
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="{{ form.brand.id_for_label }}" class="form-label">Марка</label>
|
||||
{{ form.brand }}
|
||||
{% if form.brand.errors %}
|
||||
<div class="text-danger">{{ form.brand.errors }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="{{ form.model.id_for_label }}" class="form-label">Модель</label>
|
||||
{{ form.model }}
|
||||
{% if form.model.errors %}
|
||||
<div class="text-danger">{{ form.model.errors }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="{{ form.year.id_for_label }}" class="form-label">Год выпуска</label>
|
||||
{{ form.year }}
|
||||
{% if form.year.errors %}
|
||||
<div class="text-danger">{{ form.year.errors }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="{{ form.color.id_for_label }}" class="form-label">Цвет</label>
|
||||
{{ form.color }}
|
||||
{% if form.color.errors %}
|
||||
<div class="text-danger">{{ form.color.errors }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Сохранить автомобиль</button>
|
||||
<a href="{% url 'auto_list' %}" class="btn btn-secondary">Отмена</a>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
25
templates/autoapp/auto_list.html
Normal file
25
templates/autoapp/auto_list.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<h2>Список автомобилей</h2>
|
||||
<a href="{% url 'add_auto' %}" class="btn btn-success mb-3">Добавить автомобиль</a>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Марка</th>
|
||||
<th>Модель</th>
|
||||
<th>Год</th>
|
||||
<th>Цвет</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for auto in autos %}
|
||||
<tr>
|
||||
<td>{{ auto.brand }}</td>
|
||||
<td>{{ auto.model }}</td>
|
||||
<td>{{ auto.year }}</td>
|
||||
<td>{{ auto.color|default:"—" }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="4">Автомобили пока не добавлены</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user