Remove unnecessary component creation templates

This commit is contained in:
jeremystretch
2021-08-24 14:51:12 -04:00
parent 545474a1a3
commit 52603c087b
7 changed files with 27 additions and 113 deletions
@@ -1,56 +0,0 @@
{% extends 'base/layout.html' %}
{% load helpers %}
{% load form_helpers %}
{% block title %}Create {{ component_type }}{% endblock %}
{% render_errors form %}
{% block content %}
<form action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
<div class="row">
<div class="col col-md-8 offset-md-2 col-lg-6 offset-lg-3">
<div class="field-group">
<h5 class="text-center">{{ component_type|title }}</h5>
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
{% for field in form.visible_fields %}
{% if not form.custom_fields or field.name not in form.custom_fields %}
{% render_field field %}
{% endif %}
{% endfor %}
{% if form.custom_fields %}
<div class="field-group">
<h5 class="text-center">Custom Fields</h5>
{% render_custom_fields form %}
</div>
{% endif %}
</div>
</div>
</div>
<div class="row my-3">
<div class="col col-md-8 offset-md-2 col-lg-6 offset-lg-3 text-end">
{% block buttons %}
<a class="btn btn-outline-danger" href="{{ return_url }}">Cancel</a>
{% if component_type == 'interface' and perms.ipam.add_ipaddress %}
<button type="submit" name="_assignip" class="btn btn-outline-success">
Create & Assign IP Address
</button>
{% endif %}
<button type="submit" name="_addanother" class="btn btn-outline-primary">
Create & Add Another
</button>
<button type="submit" name="_create" class="btn btn-primary">
Create
</button>
{% endblock %}
</div>
</div>
</form>
{% endblock %}
@@ -1,31 +0,0 @@
{% extends 'base/layout.html' %}
{% load form_helpers %}
{% block title %}Add {{ component_type }} to {{ parent }}{% endblock %}
{% render_errors form %}
{% block content %}
<form action="." method="post">
{% csrf_token %}
<div class="row">
<div class="col col-md-6">
<div class="field-group mb-3">
<h5 class="text-center">New {{ component_type }}</h5>
<div class="row mb-3">
<label class="col-sm-3 col-form-label">Device Type</label>
<div class="col">
<input class="form-control" value="{{ parent }}" disabled />
</div>
</div>
{% render_form form %}
</div>
</div>
<div class="col col-md-9">
<a href="{{ return_url }}" class="btn btn-outline-danger">Cancel</a>
<button type="submit" name="_update" class="btn btn-primary">Save</button>
</div>
</div>
</div>
</form>
{% endblock %}
@@ -0,0 +1,16 @@
{% extends 'generic/object_edit.html' %}
{% block buttons %}
<a class="btn btn-outline-danger" href="{{ return_url }}">Cancel</a>
{% if component_type == 'interface' and perms.ipam.add_ipaddress %}
<button type="submit" name="_assignip" class="btn btn-outline-success">
Create & Assign IP Address
</button>
{% endif %}
<button type="submit" name="_addanother" class="btn btn-outline-primary">
Create & Add Another
</button>
<button type="submit" name="_create" class="btn btn-primary">
Create
</button>
{% endblock %}
+1 -1
View File
@@ -101,7 +101,7 @@
</div>
{% elif field|widget_type == 'selectmultiple' %}
<div class="row">
<div class="row mb-3">
<label for="{{ field.id_for_label }}" class="form-label col col-md-3 text-lg-end{% if field.field.required %} required{% endif %}">
{{ field.label }}
</label>