1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

77 lines
2.5 KiB
HTML
Raw Normal View History

{% extends 'base/layout.html' %}
{% 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 %}
{% 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-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">
{% 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
{# 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 #}
{% if settings.DOCS_ROOT and object.docs_url %}
2021-10-05 15:37:49 -04:00
<div class="float-end">
<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
<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 %}
{% 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>
<button type="submit" name="_addanother" class="btn btn-outline-primary">
Create & Add Another
</button>
2021-08-13 13:35:23 -04:00
{% endif %}
<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>
</div>
2021-08-06 16:11:02 -04:00
</div>
2021-08-06 16:11:02 -04:00
{% endblock content-wrapper %}