mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-29 22:02:11 +02:00
Clean up generic view templates
This commit is contained in:
59
netbox/templates/generic/object_edit.html
Normal file
59
netbox/templates/generic/object_edit.html
Normal file
@@ -0,0 +1,59 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load form_helpers %}
|
||||
{% load helpers %}
|
||||
|
||||
{% block content %}
|
||||
<form action="" method="post" enctype="multipart/form-data" class="form form-horizontal">
|
||||
{% csrf_token %}
|
||||
{% for field in form.hidden_fields %}
|
||||
{{ field }}
|
||||
{% endfor %}
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-md-offset-3">
|
||||
<h3>
|
||||
{% if settings.DOCS_ROOT %}
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#docs_modal"><i class="mdi mdi-help-circle"></i></button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% block title %}{% if obj.pk %}Editing {{ obj_type }} {{ obj }}{% else %}Add a new {{ obj_type }}{% endif %}{% endblock %}
|
||||
</h3>
|
||||
{% block tabs %}{% endblock %}
|
||||
{% if form.non_field_errors %}
|
||||
<div class="panel panel-danger">
|
||||
<div class="panel-heading"><strong>Errors</strong></div>
|
||||
<div class="panel-body">
|
||||
{{ form.non_field_errors }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% block form %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><strong>{{ obj_type|capfirst }}</strong></div>
|
||||
<div class="panel-body">
|
||||
{% block form_fields %}
|
||||
{% render_form form %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-md-offset-3 text-right">
|
||||
{% block buttons %}
|
||||
{% if obj.pk %}
|
||||
<button type="submit" name="_update" class="btn btn-primary">Update</button>
|
||||
{% else %}
|
||||
<button type="submit" name="_create" class="btn btn-primary">Create</button>
|
||||
<button type="submit" name="_addanother" class="btn btn-primary">Create and Add Another</button>
|
||||
{% endif %}
|
||||
<a href="{{ return_url }}" class="btn btn-default">Cancel</a>
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% if obj and settings.DOCS_ROOT %}
|
||||
{% include 'inc/modal.html' with name='docs' content=obj|get_docs %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user