2024-01-17 16:25:42 -05:00
|
|
|
{% extends 'generic/_base.html' %}
|
2023-07-29 03:30:25 +07:00
|
|
|
{% load i18n %}
|
2021-03-13 02:19:42 -07:00
|
|
|
|
2022-02-08 10:56:48 -05:00
|
|
|
{% comment %}
|
|
|
|
Blocks:
|
2024-05-02 17:02:51 -04:00
|
|
|
- title: Page title
|
|
|
|
- controls: Control elements displayed between the header and content
|
|
|
|
- tabs: Page tabs
|
|
|
|
- content: Primary page content
|
|
|
|
- form: Content within the <form> element
|
|
|
|
- buttons: Form submission buttons
|
|
|
|
- modals: Any pre-loaded modals
|
2022-02-08 10:56:48 -05:00
|
|
|
|
|
|
|
Context:
|
2024-05-02 17:02:51 -04:00
|
|
|
- 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
|
2022-02-08 10:56:48 -05:00
|
|
|
{% endcomment %}
|
|
|
|
|
2021-05-23 13:21:52 -07:00
|
|
|
{% block title %}
|
2023-08-02 14:53:32 -04:00
|
|
|
{% if object.pk %}
|
|
|
|
{% trans "Editing" %} {{ object|meta:"verbose_name" }} {{ object }}
|
|
|
|
{% else %}
|
2023-09-11 16:17:02 -04:00
|
|
|
{% blocktrans trimmed with object_type=object|meta:"verbose_name" %}
|
2023-08-02 14:53:32 -04:00
|
|
|
Add a new {{ object_type }}
|
|
|
|
{% endblocktrans %}
|
|
|
|
{% endif %}
|
2021-05-23 13:21:52 -07:00
|
|
|
{% endblock title %}
|
2021-03-13 02:19:42 -07:00
|
|
|
|
2024-01-17 16:25:42 -05:00
|
|
|
{% block controls %}
|
|
|
|
<div class="btn-list">
|
|
|
|
|
|
|
|
{# Link to model documentation #}
|
|
|
|
{% if settings.DOCS_ROOT and object.docs_url %}
|
|
|
|
<a href="{{ object.docs_url }}" target="_blank" class="btn btn-outline-secondary" title="{% trans "View model documentation" %}">
|
|
|
|
<i class="mdi mdi-help-circle"></i> {% trans "Help" %}
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
{% endblock controls %}
|
|
|
|
|
2021-08-06 16:11:02 -04:00
|
|
|
{% block tabs %}
|
2024-01-17 16:25:42 -05:00
|
|
|
<ul class="nav nav-tabs">
|
2021-08-06 16:11:02 -04:00
|
|
|
<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">
|
2023-07-29 03:30:25 +07:00
|
|
|
{% if object.pk %}{% trans "Edit" %}{% else %}{% trans "Create" %}{% endif %}
|
2021-08-06 16:11:02 -04:00
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
{% endblock tabs %}
|
|
|
|
|
2024-01-17 16:25:42 -05:00
|
|
|
{% block 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
|
|
|
|
2024-01-17 16:25:42 -05:00
|
|
|
{# Warn about missing prerequisite objects #}
|
|
|
|
{% if prerequisite_model %}
|
|
|
|
{% include 'inc/missing_prerequisites.html' %}
|
|
|
|
{% endif %}
|
2022-08-25 14:11:46 -04:00
|
|
|
|
2024-01-17 16:25:42 -05:00
|
|
|
<form action="" method="post" enctype="multipart/form-data" class="object-edit mt-5">
|
|
|
|
{% csrf_token %}
|
2021-10-05 15:37:49 -04:00
|
|
|
|
2024-03-28 11:51:38 -04:00
|
|
|
<div id="form_fields" hx-disinherit="hx-select hx-swap">
|
2024-01-17 16:25:42 -05:00
|
|
|
{% block form %}
|
|
|
|
{% include 'htmx/form.html' %}
|
|
|
|
{% endblock form %}
|
|
|
|
</div>
|
2021-08-13 13:35:23 -04:00
|
|
|
|
2024-01-17 16:25:42 -05:00
|
|
|
<div class="text-end my-3">
|
|
|
|
{% block buttons %}
|
|
|
|
<a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
|
|
|
|
{% if object.pk %}
|
|
|
|
<button type="submit" name="_update" class="btn btn-primary">
|
|
|
|
{% trans "Save" %}
|
|
|
|
</button>
|
|
|
|
{% else %}
|
|
|
|
<div class="btn-group" role="group" aria-label="{% trans "Actions" %}">
|
2021-08-13 13:35:23 -04:00
|
|
|
<button type="submit" name="_create" class="btn btn-primary">
|
2023-07-29 03:30:25 +07:00
|
|
|
{% trans "Create" %}
|
2021-08-13 13:35:23 -04:00
|
|
|
</button>
|
2022-07-19 14:21:20 -04:00
|
|
|
<button type="submit" name="_addanother" class="btn btn-outline-primary">
|
2023-07-29 03:30:25 +07:00
|
|
|
{% trans "Create & Add Another" %}
|
2022-07-19 14:21:20 -04:00
|
|
|
</button>
|
2024-01-17 16:25:42 -05:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endblock buttons %}
|
|
|
|
</div>
|
|
|
|
</form>
|
2021-08-06 16:11:02 -04:00
|
|
|
</div>
|
2024-01-17 16:25:42 -05:00
|
|
|
{% endblock content %}
|
2023-03-13 12:44:26 -04:00
|
|
|
|
|
|
|
{% block modals %}
|
|
|
|
{% include 'inc/htmx_modal.html' with size='lg' %}
|
|
|
|
{% endblock %}
|