2021-07-22 11:58:47 -04:00
|
|
|
{% extends 'base/layout.html' %}
|
2021-03-13 02:19:42 -07:00
|
|
|
|
2022-02-08 10:56:48 -05:00
|
|
|
{% comment %}
|
|
|
|
Blocks:
|
|
|
|
form: Content within the <form> element
|
|
|
|
buttons: Form submission buttons
|
|
|
|
|
|
|
|
Context:
|
|
|
|
object: Python instance of the object being edited
|
|
|
|
form: The edit form
|
|
|
|
return_url: The URL to which the user is redirected after submitting the form
|
|
|
|
{% endcomment %}
|
|
|
|
|
2021-05-23 13:21:52 -07:00
|
|
|
{% block title %}
|
2022-02-08 10:56:48 -05:00
|
|
|
{% if object.pk %}Editing {{ object|meta:"verbose_name" }} {{ object }}{% else %}Add a new {{ object|meta:"verbose_name" }}{% endif %}
|
2021-05-23 13:21:52 -07:00
|
|
|
{% endblock title %}
|
2021-03-13 02:19:42 -07:00
|
|
|
|
2021-08-06 16:11:02 -04:00
|
|
|
{% block tabs %}
|
|
|
|
<ul class="nav nav-tabs px-3">
|
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
<button class="nav-link active" id="edit-form-tab" data-bs-toggle="tab" data-bs-target="#edit-form" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
|
2022-02-08 10:56:48 -05:00
|
|
|
{% if object.pk %}Edit{% else %}Create{% endif %}
|
2021-08-06 16:11:02 -04:00
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
{% endblock tabs %}
|
|
|
|
|
|
|
|
{% block content-wrapper %}
|
|
|
|
<div class="tab-content">
|
|
|
|
<div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="object-list-tab">
|
2021-10-05 15:37:49 -04:00
|
|
|
|
2022-08-25 14:11:46 -04:00
|
|
|
{# Warn about missing prerequisite objects #}
|
|
|
|
{% if prerequisite_model %}
|
|
|
|
{% include 'inc/missing_prerequisites.html' %}
|
|
|
|
{% endif %}
|
|
|
|
|
2021-10-05 15:37:49 -04:00
|
|
|
{# Link to model documentation #}
|
2022-10-27 09:44:09 -04:00
|
|
|
{% if settings.DOCS_ROOT and object.docs_url %}
|
2021-10-05 15:37:49 -04:00
|
|
|
<div class="float-end">
|
2022-10-27 09:44:09 -04:00
|
|
|
<a href="{{ object.docs_url }}" target="_blank" class="btn btn-sm btn-outline-secondary" title="View model documentation">
|
2021-10-05 15:37:49 -04:00
|
|
|
<i class="mdi mdi-help-circle"></i> Help
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
2021-12-28 10:22:00 -05:00
|
|
|
<form action="" method="post" enctype="multipart/form-data" class="form-object-edit mt-5">
|
2021-08-06 16:11:02 -04:00
|
|
|
{% csrf_token %}
|
2021-08-13 13:35:23 -04:00
|
|
|
|
2023-01-31 10:07:24 -05:00
|
|
|
<div id="form_fields">
|
|
|
|
{% block form %}
|
|
|
|
{% include 'htmx/form.html' %}
|
|
|
|
{% endblock form %}
|
|
|
|
</div>
|
2021-08-13 13:35:23 -04:00
|
|
|
|
|
|
|
<div class="text-end my-3">
|
|
|
|
{% block buttons %}
|
2022-02-08 10:56:48 -05:00
|
|
|
{% if object.pk %}
|
2021-08-13 13:35:23 -04:00
|
|
|
<button type="submit" name="_update" class="btn btn-primary">
|
|
|
|
Save
|
|
|
|
</button>
|
|
|
|
{% else %}
|
|
|
|
<button type="submit" name="_create" class="btn btn-primary">
|
|
|
|
Create
|
|
|
|
</button>
|
2022-07-19 14:21:20 -04:00
|
|
|
<button type="submit" name="_addanother" class="btn btn-outline-primary">
|
|
|
|
Create & Add Another
|
|
|
|
</button>
|
2021-08-13 13:35:23 -04:00
|
|
|
{% endif %}
|
2022-07-19 14:21:20 -04:00
|
|
|
<a class="btn btn-outline-danger" href="{{ return_url }}">Cancel</a>
|
2021-08-13 13:35:23 -04:00
|
|
|
{% endblock buttons %}
|
2021-08-06 16:11:02 -04:00
|
|
|
</div>
|
|
|
|
</form>
|
2021-03-13 02:19:42 -07:00
|
|
|
</div>
|
2021-08-06 16:11:02 -04:00
|
|
|
</div>
|
2021-05-26 08:53:05 -07:00
|
|
|
|
2021-08-06 16:11:02 -04:00
|
|
|
{% endblock content-wrapper %}
|
2023-03-13 12:44:26 -04:00
|
|
|
|
|
|
|
{% block modals %}
|
|
|
|
{% include 'inc/htmx_modal.html' with size='lg' %}
|
|
|
|
{% endblock %}
|