Browse Source

Introduced an object import template

Jeremy Stretch 8 years ago
parent
commit
79089cc47e

+ 51 - 66
netbox/templates/circuits/circuit_import.html

@@ -1,72 +1,57 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}Circuit Import{% endblock %}
 {% block title %}Circuit Import{% endblock %}
 
 
-{% block content %}
-<h1>Circuit Import</h1>
-<div class="row">
-	<div class="col-md-6">
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-		    <div class="form-group">
-		        <button type="submit" class="btn btn-primary">Submit</button>
-		        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
-		    </div>
-		</form>
-	</div>
-	<div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>Circuit ID</td>
-					<td>Alphanumeric circuit identifier</td>
-					<td>IC-603122</td>
-				</tr>
-				<tr>
-					<td>Provider</td>
-					<td>Name of circuit provider</td>
-					<td>TeliaSonera</td>
-				</tr>
-				<tr>
-					<td>Type</td>
-					<td>Circuit type</td>
-					<td>Transit</td>
-				</tr>
-				<tr>
-					<td>Tenant</td>
-					<td>Name of tenant (optional)</td>
-					<td>Strickland Propane</td>
-				</tr>
-				<tr>
-					<td>Install Date</td>
-					<td>Date in YYYY-MM-DD format (optional)</td>
-					<td>2016-02-23</td>
-				</tr>
-				<tr>
-					<td>Commit rate</td>
-					<td>Commited rate in Kbps (optional)</td>
-					<td>2000</td>
-				</tr>
-				<tr>
-					<td>Description</td>
-					<td>Short description (optional)</td>
-					<td>Primary for voice</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>IC-603122,TeliaSonera,Transit,Strickland Propane,2016-02-23,2000,Primary for voice</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>Circuit ID</td>
+                <td>Alphanumeric circuit identifier</td>
+                <td>IC-603122</td>
+            </tr>
+            <tr>
+                <td>Provider</td>
+                <td>Name of circuit provider</td>
+                <td>TeliaSonera</td>
+            </tr>
+            <tr>
+                <td>Type</td>
+                <td>Circuit type</td>
+                <td>Transit</td>
+            </tr>
+            <tr>
+                <td>Tenant</td>
+                <td>Name of tenant (optional)</td>
+                <td>Strickland Propane</td>
+            </tr>
+            <tr>
+                <td>Install Date</td>
+                <td>Date in YYYY-MM-DD format (optional)</td>
+                <td>2016-02-23</td>
+            </tr>
+            <tr>
+                <td>Commit rate</td>
+                <td>Commited rate in Kbps (optional)</td>
+                <td>2000</td>
+            </tr>
+            <tr>
+                <td>Description</td>
+                <td>Short description (optional)</td>
+                <td>Primary for voice</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>IC-603122,TeliaSonera,Transit,Strickland Propane,2016-02-23,2000,Primary for voice</pre>
 {% endblock %}
 {% endblock %}

+ 41 - 56
netbox/templates/circuits/provider_import.html

@@ -1,62 +1,47 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}Provider Import{% endblock %}
 {% block title %}Provider Import{% endblock %}
 
 
-{% block content %}
-<h1>Provider Import</h1>
-<div class="row">
-	<div class="col-md-6">
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-		    <div class="form-group">
-		        <button type="submit" class="btn btn-primary">Submit</button>
-		        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
-		    </div>
-		</form>
-	</div>
-	<div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>Name</td>
-					<td>Provider's proper name</td>
-					<td>Level 3</td>
-				</tr>
-				<tr>
-					<td>Slug</td>
-					<td>URL-friendly name</td>
-					<td>level3</td>
-				</tr>
-				<tr>
-					<td>ASN</td>
-					<td>Autonomous system number (optional)</td>
-					<td>3356</td>
-				</tr>
-				<tr>
-					<td>Account</td>
-					<td>Account number (optional)</td>
-					<td>08931544</td>
-				</tr>
-				<tr>
-					<td>Portal URL</td>
-					<td>Customer service portal URL (optional)</td>
-					<td>https://mylevel3.net</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>Level 3,level3,3356,08931544,https://mylevel3.net</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>Name</td>
+                <td>Provider's proper name</td>
+                <td>Level 3</td>
+            </tr>
+            <tr>
+                <td>Slug</td>
+                <td>URL-friendly name</td>
+                <td>level3</td>
+            </tr>
+            <tr>
+                <td>ASN</td>
+                <td>Autonomous system number (optional)</td>
+                <td>3356</td>
+            </tr>
+            <tr>
+                <td>Account</td>
+                <td>Account number (optional)</td>
+                <td>08931544</td>
+            </tr>
+            <tr>
+                <td>Portal URL</td>
+                <td>Customer service portal URL (optional)</td>
+                <td>https://mylevel3.net</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>Level 3,level3,3356,08931544,https://mylevel3.net</pre>
 {% endblock %}
 {% endblock %}

+ 41 - 57
netbox/templates/dcim/console_connections_import.html

@@ -1,63 +1,47 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}Console Connections Import{% endblock %}
 {% block title %}Console Connections Import{% endblock %}
 
 
-{% block content %}
-<h1>Console Connections Import</h1>
-<div class="row">
-	<div class="col-md-6">
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-            <div class="form-group">
-                <div class="col-md-12 text-right">
-		            <button type="submit" class="btn btn-primary">Submit</button>
-                </div>
-            </div>
-		</form>
-    </div>
-    <div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>Console server</td>
-					<td>Device name or {ID}</td>
-					<td>abc1-cs3</td>
-				</tr>
-				<tr>
-					<td>Console server port</td>
-					<td>Full CS port name</td>
-					<td>Port 35</td>
-				</tr>
-				<tr>
-					<td>Device</td>
-					<td>Device name or {ID}</td>
-					<td>abc1-switch7</td>
-				</tr>
-				<tr>
-					<td>Console Port</td>
-					<td>Console port name</td>
-					<td>Console</td>
-				</tr>
-				<tr>
-					<td>Connection Status</td>
-					<td>"planned" or "connected"</td>
-					<td>planned</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>abc1-cs3,Port 35,abc1-switch7,Console,planned</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>Console server</td>
+                <td>Device name or {ID}</td>
+                <td>abc1-cs3</td>
+            </tr>
+            <tr>
+                <td>Console server port</td>
+                <td>Full CS port name</td>
+                <td>Port 35</td>
+            </tr>
+            <tr>
+                <td>Device</td>
+                <td>Device name or {ID}</td>
+                <td>abc1-switch7</td>
+            </tr>
+            <tr>
+                <td>Console Port</td>
+                <td>Console port name</td>
+                <td>Console</td>
+            </tr>
+            <tr>
+                <td>Connection Status</td>
+                <td>"planned" or "connected"</td>
+                <td>planned</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>abc1-cs3,Port 35,abc1-switch7,Console,planned</pre>
 {% endblock %}
 {% endblock %}

+ 6 - 2
netbox/templates/dcim/device_import.html

@@ -12,8 +12,12 @@
 		    {% csrf_token %}
 		    {% csrf_token %}
 		    {% render_form form %}
 		    {% render_form form %}
             <div class="form-group">
             <div class="form-group">
-                <button type="submit" class="btn btn-primary">Submit</button>
-                <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
+                <div class="col-md-12 text-right">
+		            <button type="submit" class="btn btn-primary">Submit</button>
+		            {% if return_url %}
+                        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
+                    {% endif %}
+                </div>
             </div>
             </div>
 		</form>
 		</form>
 		<h4>CSV Format</h4>
 		<h4>CSV Format</h4>

+ 6 - 2
netbox/templates/dcim/device_import_child.html

@@ -12,8 +12,12 @@
 		    {% csrf_token %}
 		    {% csrf_token %}
 		    {% render_form form %}
 		    {% render_form form %}
             <div class="form-group">
             <div class="form-group">
-                <button type="submit" class="btn btn-primary">Submit</button>
-                <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
+                <div class="col-md-12 text-right">
+		            <button type="submit" class="btn btn-primary">Submit</button>
+		            {% if return_url %}
+                        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
+                    {% endif %}
+                </div>
             </div>
             </div>
 		</form>
 		</form>
 		<h4>CSV Format</h4>
 		<h4>CSV Format</h4>

+ 41 - 65
netbox/templates/dcim/interface_connections_import.html

@@ -1,71 +1,47 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}Interface Connections Import{% endblock %}
 {% block title %}Interface Connections Import{% endblock %}
 
 
-{% block content %}
-<h1>Interface Connections Import</h1>
-<div class="row">
-	<div class="col-md-6">
-        {% 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 %}
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-            <div class="form-group">
-                <div class="col-md-12 text-right">
-		            <button type="submit" class="btn btn-primary">Submit</button>
-                </div>
-            </div>
-		</form>
-    </div>
-    <div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>Device A</td>
-					<td>Device name or {ID}</td>
-					<td>abc1-core1</td>
-				</tr>
-				<tr>
-					<td>Interface A</td>
-					<td>Interface name</td>
-					<td>xe-0/0/6</td>
-				</tr>
-				<tr>
-					<td>Device B</td>
-					<td>Device name or {ID}</td>
-					<td>abc1-switch7</td>
-				</tr>
-				<tr>
-					<td>Interface B</td>
-					<td>Interface name</td>
-					<td>xe-0/0/0</td>
-				</tr>
-				<tr>
-					<td>Connection Status</td>
-					<td>"planned" or "connected"</td>
-					<td>planned</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>abc1-core1,xe-0/0/6,abc1-switch7,xe-0/0/0,planned</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>Device A</td>
+                <td>Device name or {ID}</td>
+                <td>abc1-core1</td>
+            </tr>
+            <tr>
+                <td>Interface A</td>
+                <td>Interface name</td>
+                <td>xe-0/0/6</td>
+            </tr>
+            <tr>
+                <td>Device B</td>
+                <td>Device name or {ID}</td>
+                <td>abc1-switch7</td>
+            </tr>
+            <tr>
+                <td>Interface B</td>
+                <td>Interface name</td>
+                <td>xe-0/0/0</td>
+            </tr>
+            <tr>
+                <td>Connection Status</td>
+                <td>"planned" or "connected"</td>
+                <td>planned</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>abc1-core1,xe-0/0/6,abc1-switch7,xe-0/0/0,planned</pre>
 {% endblock %}
 {% endblock %}

+ 41 - 57
netbox/templates/dcim/power_connections_import.html

@@ -1,63 +1,47 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}Power Connections Import{% endblock %}
 {% block title %}Power Connections Import{% endblock %}
 
 
-{% block content %}
-<h1>Power Connections Import</h1>
-<div class="row">
-	<div class="col-md-6">
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-            <div class="form-group">
-                <div class="col-md-12 text-right">
-		            <button type="submit" class="btn btn-primary">Submit</button>
-                </div>
-            </div>
-		</form>
-    </div>
-    <div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>PDU</td>
-					<td>Device name or {ID}</td>
-					<td>abc1-pdu1</td>
-				</tr>
-				<tr>
-					<td>Power Outlet</td>
-					<td>Power outlet name</td>
-					<td>AC4</td>
-				</tr>
-				<tr>
-					<td>Device</td>
-					<td>Device name or {ID}</td>
-					<td>abc1-switch7</td>
-				</tr>
-				<tr>
-					<td>Power Port</td>
-					<td>Power port name</td>
-					<td>PSU0</td>
-				</tr>
-				<tr>
-					<td>Connection Status</td>
-					<td>"planned" or "connected"</td>
-					<td>connected</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>abc1-pdu1,AC4,abc1-switch7,PSU0,connected</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>PDU</td>
+                <td>Device name or {ID}</td>
+                <td>abc1-pdu1</td>
+            </tr>
+            <tr>
+                <td>Power Outlet</td>
+                <td>Power outlet name</td>
+                <td>AC4</td>
+            </tr>
+            <tr>
+                <td>Device</td>
+                <td>Device name or {ID}</td>
+                <td>abc1-switch7</td>
+            </tr>
+            <tr>
+                <td>Power Port</td>
+                <td>Power port name</td>
+                <td>PSU0</td>
+            </tr>
+            <tr>
+                <td>Connection Status</td>
+                <td>"planned" or "connected"</td>
+                <td>connected</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>abc1-pdu1,AC4,abc1-switch7,PSU0,connected</pre>
 {% endblock %}
 {% endblock %}

+ 66 - 81
netbox/templates/dcim/rack_import.html

@@ -1,87 +1,72 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}Rack Import{% endblock %}
 {% block title %}Rack Import{% endblock %}
 
 
-{% block content %}
-<h1>Rack Import</h1>
-<div class="row">
-	<div class="col-md-6">
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-		    <div class="form-group">
-		        <button type="submit" class="btn btn-primary">Submit</button>
-                <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
-		    </div>
-		</form>
-	</div>
-	<div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>Site</td>
-					<td>Name of the assigned site</td>
-					<td>DC-4</td>
-				</tr>
-				<tr>
-					<td>Group</td>
-					<td>Rack group name (optional)</td>
-					<td>Cage 1400</td>
-				</tr>
-				<tr>
-					<td>Name</td>
-					<td>Internal rack name</td>
-					<td>R101</td>
-				</tr>
-				<tr>
-					<td>Facility ID</td>
-					<td>Rack ID assigned by the facility (optional)</td>
-					<td>J12.100</td>
-				</tr>
-				<tr>
-					<td>Tenant</td>
-					<td>Name of tenant (optional)</td>
-					<td>Pied Piper</td>
-				</tr>
-				<tr>
-					<td>Role</td>
-					<td>Functional role (optional)</td>
-					<td>Compute</td>
-				</tr>
-				<tr>
-					<td>Type</td>
-					<td>Rack type (optional)</td>
-					<td>4-post cabinet</td>
-				</tr>
-				<tr>
-					<td>Width</td>
-					<td>Rail-to-rail width (19 or 23 inches)</td>
-					<td>19</td>
-				</tr>
-				<tr>
-					<td>Height</td>
-					<td>Height in rack units</td>
-					<td>42</td>
-				</tr>
-				<tr>
-					<td>Descending units</td>
-					<td>Units are numbered top-to-bottom</td>
-					<td>False</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>DC-4,Cage 1400,R101,J12.100,Pied Piper,Compute,4-post cabinet,19,42,False</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>Site</td>
+                <td>Name of the assigned site</td>
+                <td>DC-4</td>
+            </tr>
+            <tr>
+                <td>Group</td>
+                <td>Rack group name (optional)</td>
+                <td>Cage 1400</td>
+            </tr>
+            <tr>
+                <td>Name</td>
+                <td>Internal rack name</td>
+                <td>R101</td>
+            </tr>
+            <tr>
+                <td>Facility ID</td>
+                <td>Rack ID assigned by the facility (optional)</td>
+                <td>J12.100</td>
+            </tr>
+            <tr>
+                <td>Tenant</td>
+                <td>Name of tenant (optional)</td>
+                <td>Pied Piper</td>
+            </tr>
+            <tr>
+                <td>Role</td>
+                <td>Functional role (optional)</td>
+                <td>Compute</td>
+            </tr>
+            <tr>
+                <td>Type</td>
+                <td>Rack type (optional)</td>
+                <td>4-post cabinet</td>
+            </tr>
+            <tr>
+                <td>Width</td>
+                <td>Rail-to-rail width (19 or 23 inches)</td>
+                <td>19</td>
+            </tr>
+            <tr>
+                <td>Height</td>
+                <td>Height in rack units</td>
+                <td>42</td>
+            </tr>
+            <tr>
+                <td>Descending units</td>
+                <td>Units are numbered top-to-bottom</td>
+                <td>False</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>DC-4,Cage 1400,R101,J12.100,Pied Piper,Compute,4-post cabinet,19,42,False</pre>
 {% endblock %}
 {% endblock %}

+ 36 - 51
netbox/templates/ipam/aggregate_import.html

@@ -1,57 +1,42 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}Aggregate Import{% endblock %}
 {% block title %}Aggregate Import{% endblock %}
 
 
-{% block content %}
-<h1>Aggregate Import</h1>
-<div class="row">
-	<div class="col-md-6">
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-		    <div class="form-group">
-		        <button type="submit" class="btn btn-primary">Submit</button>
-		        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
-		    </div>
-		</form>
-	</div>
-	<div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>Prefix</td>
-					<td>IPv4 or IPv6 network</td>
-					<td>172.16.0.0/12</td>
-				</tr>
-				<tr>
-					<td>RIR</td>
-					<td>Name of RIR</td>
-					<td>RFC 1918</td>
-				</tr>
-				<tr>
-					<td>Date Added</td>
-					<td>Date in YYYY-MM-DD format (optional)</td>
-					<td>2016-02-23</td>
-				</tr>
-				<tr>
-					<td>Description</td>
-					<td>Short description (optional)</td>
-					<td>Private IPv4 space</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>172.16.0.0/12,RFC 1918,2016-02-23,Private IPv4 space</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>Prefix</td>
+                <td>IPv4 or IPv6 network</td>
+                <td>172.16.0.0/12</td>
+            </tr>
+            <tr>
+                <td>RIR</td>
+                <td>Name of RIR</td>
+                <td>RFC 1918</td>
+            </tr>
+            <tr>
+                <td>Date Added</td>
+                <td>Date in YYYY-MM-DD format (optional)</td>
+                <td>2016-02-23</td>
+            </tr>
+            <tr>
+                <td>Description</td>
+                <td>Short description (optional)</td>
+                <td>Private IPv4 space</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>172.16.0.0/12,RFC 1918,2016-02-23,Private IPv4 space</pre>
 {% endblock %}
 {% endblock %}

+ 56 - 71
netbox/templates/ipam/ipaddress_import.html

@@ -1,77 +1,62 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}IP Address Import{% endblock %}
 {% block title %}IP Address Import{% endblock %}
 
 
-{% block content %}
-<h1>IP Address Import</h1>
-<div class="row">
-	<div class="col-md-6">
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-		    <div class="form-group">
-		        <button type="submit" class="btn btn-primary">Submit</button>
-		        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
-		    </div>
-		</form>
-	</div>
-	<div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>Address</td>
-					<td>IPv4 or IPv6 address</td>
-					<td>192.0.2.42/24</td>
-				</tr>
-				<tr>
-					<td>VRF</td>
-					<td>VRF route distinguisher (optional)</td>
-					<td>65000:123</td>
-				</tr>
-				<tr>
-					<td>Tenant</td>
-					<td>Name of tenant (optional)</td>
-					<td>ABC01</td>
-				</tr>
-				<tr>
-					<td>Status</td>
-					<td>Current status</td>
-					<td>Active</td>
-				</tr>
-				<tr>
-					<td>Device</td>
-					<td>Device name (optional)</td>
-					<td>switch12</td>
-				</tr>
-				<tr>
-					<td>Interface</td>
-					<td>Interface name (optional)</td>
-					<td>ge-0/0/31</td>
-				</tr>
-				<tr>
-					<td>Is Primary</td>
-					<td>If "true", IP will be primary for device (optional)</td>
-					<td>True</td>
-				</tr>
-				<tr>
-					<td>Description</td>
-					<td>Short description (optional)</td>
-					<td>Management IP</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>192.0.2.42/24,65000:123,ABC01,Active,switch12,ge-0/0/31,True,Management IP</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>Address</td>
+                <td>IPv4 or IPv6 address</td>
+                <td>192.0.2.42/24</td>
+            </tr>
+            <tr>
+                <td>VRF</td>
+                <td>VRF route distinguisher (optional)</td>
+                <td>65000:123</td>
+            </tr>
+            <tr>
+                <td>Tenant</td>
+                <td>Name of tenant (optional)</td>
+                <td>ABC01</td>
+            </tr>
+            <tr>
+                <td>Status</td>
+                <td>Current status</td>
+                <td>Active</td>
+            </tr>
+            <tr>
+                <td>Device</td>
+                <td>Device name (optional)</td>
+                <td>switch12</td>
+            </tr>
+            <tr>
+                <td>Interface</td>
+                <td>Interface name (optional)</td>
+                <td>ge-0/0/31</td>
+            </tr>
+            <tr>
+                <td>Is Primary</td>
+                <td>If "true", IP will be primary for device (optional)</td>
+                <td>True</td>
+            </tr>
+            <tr>
+                <td>Description</td>
+                <td>Short description (optional)</td>
+                <td>Management IP</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>192.0.2.42/24,65000:123,ABC01,Active,switch12,ge-0/0/31,True,Management IP</pre>
 {% endblock %}
 {% endblock %}

+ 66 - 81
netbox/templates/ipam/prefix_import.html

@@ -1,87 +1,72 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}Prefix Import{% endblock %}
 {% block title %}Prefix Import{% endblock %}
 
 
-{% block content %}
-<h1>Prefix Import</h1>
-<div class="row">
-	<div class="col-md-6">
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-		    <div class="form-group">
-		        <button type="submit" class="btn btn-primary">Submit</button>
-		        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
-		    </div>
-		</form>
-	</div>
-	<div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>Prefix</td>
-					<td>IPv4 or IPv6 network</td>
-					<td>192.168.42.0/24</td>
-				</tr>
-				<tr>
-					<td>VRF</td>
-					<td>VRF route distinguisher (optional)</td>
-					<td>65000:123</td>
-				</tr>
-				<tr>
-					<td>Tenant</td>
-					<td>Name of tenant (optional)</td>
-					<td>ABC01</td>
-				</tr>
-				<tr>
-					<td>Site</td>
-					<td>Name of assigned site (optional)</td>
-					<td>HQ</td>
-				</tr>
-				<tr>
-					<td>VLAN Group</td>
-					<td>Name of group for VLAN selection (optional)</td>
-					<td>Customers</td>
-				</tr>
-				<tr>
-					<td>VLAN ID</td>
-					<td>Numeric VLAN ID (optional)</td>
-					<td>801</td>
-				</tr>
-				<tr>
-					<td>Status</td>
-					<td>Current status</td>
-					<td>Active</td>
-				</tr>
-				<tr>
-					<td>Role</td>
-					<td>Functional role (optional)</td>
-					<td>Customer</td>
-				</tr>
-				<tr>
-					<td>Is a pool</td>
-					<td>True if all IPs are considered usable</td>
-					<td>False</td>
-				</tr>
-				<tr>
-					<td>Description</td>
-					<td>Short description (optional)</td>
-					<td>7th floor WiFi</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>192.168.42.0/24,65000:123,ABC01,HQ,Customers,801,Active,Customer,False,7th floor WiFi</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>Prefix</td>
+                <td>IPv4 or IPv6 network</td>
+                <td>192.168.42.0/24</td>
+            </tr>
+            <tr>
+                <td>VRF</td>
+                <td>VRF route distinguisher (optional)</td>
+                <td>65000:123</td>
+            </tr>
+            <tr>
+                <td>Tenant</td>
+                <td>Name of tenant (optional)</td>
+                <td>ABC01</td>
+            </tr>
+            <tr>
+                <td>Site</td>
+                <td>Name of assigned site (optional)</td>
+                <td>HQ</td>
+            </tr>
+            <tr>
+                <td>VLAN Group</td>
+                <td>Name of group for VLAN selection (optional)</td>
+                <td>Customers</td>
+            </tr>
+            <tr>
+                <td>VLAN ID</td>
+                <td>Numeric VLAN ID (optional)</td>
+                <td>801</td>
+            </tr>
+            <tr>
+                <td>Status</td>
+                <td>Current status</td>
+                <td>Active</td>
+            </tr>
+            <tr>
+                <td>Role</td>
+                <td>Functional role (optional)</td>
+                <td>Customer</td>
+            </tr>
+            <tr>
+                <td>Is a pool</td>
+                <td>True if all IPs are considered usable</td>
+                <td>False</td>
+            </tr>
+            <tr>
+                <td>Description</td>
+                <td>Short description (optional)</td>
+                <td>7th floor WiFi</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>192.168.42.0/24,65000:123,ABC01,HQ,Customers,801,Active,Customer,False,7th floor WiFi</pre>
 {% endblock %}
 {% endblock %}

+ 56 - 71
netbox/templates/ipam/vlan_import.html

@@ -1,77 +1,62 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}VLAN Import{% endblock %}
 {% block title %}VLAN Import{% endblock %}
 
 
-{% block content %}
-<h1>VLAN Import</h1>
-<div class="row">
-	<div class="col-md-6">
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-		    <div class="form-group">
-		        <button type="submit" class="btn btn-primary">Submit</button>
-		        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
-		    </div>
-		</form>
-	</div>
-	<div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>Site</td>
-					<td>Name of assigned site</td>
-					<td>LAS2</td>
-				</tr>
-				<tr>
-					<td>Group</td>
-					<td>Name of VLAN group (optional)</td>
-					<td>Backend Network</td>
-				</tr>
-				<tr>
-					<td>ID</td>
-					<td>Configured VLAN ID</td>
-					<td>1400</td>
-				</tr>
-				<tr>
-					<td>Name</td>
-					<td>Configured VLAN name</td>
-					<td>Cameras</td>
-				</tr>
-				<tr>
-					<td>Tenant</td>
-					<td>Name of tenant (optional)</td>
-					<td>Internal</td>
-				</tr>
-				<tr>
-					<td>Status</td>
-					<td>Current status</td>
-					<td>Active</td>
-				</tr>
-				<tr>
-					<td>Role</td>
-					<td>Functional role (optional)</td>
-					<td>Security</td>
-				</tr>
-				<tr>
-					<td>Description</td>
-					<td>Short description (optional)</td>
-					<td>Security team only</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>LAS2,Backend Network,1400,Cameras,Internal,Active,Security,Security team only</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>Site</td>
+                <td>Name of assigned site</td>
+                <td>LAS2</td>
+            </tr>
+            <tr>
+                <td>Group</td>
+                <td>Name of VLAN group (optional)</td>
+                <td>Backend Network</td>
+            </tr>
+            <tr>
+                <td>ID</td>
+                <td>Configured VLAN ID</td>
+                <td>1400</td>
+            </tr>
+            <tr>
+                <td>Name</td>
+                <td>Configured VLAN name</td>
+                <td>Cameras</td>
+            </tr>
+            <tr>
+                <td>Tenant</td>
+                <td>Name of tenant (optional)</td>
+                <td>Internal</td>
+            </tr>
+            <tr>
+                <td>Status</td>
+                <td>Current status</td>
+                <td>Active</td>
+            </tr>
+            <tr>
+                <td>Role</td>
+                <td>Functional role (optional)</td>
+                <td>Security</td>
+            </tr>
+            <tr>
+                <td>Description</td>
+                <td>Short description (optional)</td>
+                <td>Security team only</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>LAS2,Backend Network,1400,Cameras,Internal,Active,Security,Security team only</pre>
 {% endblock %}
 {% endblock %}

+ 41 - 56
netbox/templates/ipam/vrf_import.html

@@ -1,62 +1,47 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}VRF Import{% endblock %}
 {% block title %}VRF Import{% endblock %}
 
 
-{% block content %}
-<h1>VRF Import</h1>
-<div class="row">
-	<div class="col-md-6">
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-		    <div class="form-group">
-		        <button type="submit" class="btn btn-primary">Submit</button>
-		        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
-		    </div>
-		</form>
-	</div>
-	<div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>Name</td>
-					<td>Name of VRF</td>
-					<td>Customer_ABC</td>
-				</tr>
-				<tr>
-					<td>RD</td>
-					<td>Route distinguisher</td>
-					<td>65000:123456</td>
-				</tr>
-				<tr>
-					<td>Tenant</td>
-					<td>Name of tenant (optional)</td>
-					<td>ABC01</td>
-				</tr>
-				<tr>
-					<td>Enforce uniqueness</td>
-					<td>Prevent duplicate prefixes/IP addresses</td>
-					<td>True</td>
-				</tr>
-				<tr>
-					<td>Description</td>
-					<td>Short description (optional)</td>
-					<td>Native VRF for customer ABC</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>Customer_ABC,65000:123456,ABC01,True,Native VRF for customer ABC</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>Name</td>
+                <td>Name of VRF</td>
+                <td>Customer_ABC</td>
+            </tr>
+            <tr>
+                <td>RD</td>
+                <td>Route distinguisher</td>
+                <td>65000:123456</td>
+            </tr>
+            <tr>
+                <td>Tenant</td>
+                <td>Name of tenant (optional)</td>
+                <td>ABC01</td>
+            </tr>
+            <tr>
+                <td>Enforce uniqueness</td>
+                <td>Prevent duplicate prefixes/IP addresses</td>
+                <td>True</td>
+            </tr>
+            <tr>
+                <td>Description</td>
+                <td>Short description (optional)</td>
+                <td>Native VRF for customer ABC</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>Customer_ABC,65000:123456,ABC01,True,Native VRF for customer ABC</pre>
 {% endblock %}
 {% endblock %}

+ 8 - 4
netbox/templates/secrets/secret_import.html

@@ -20,10 +20,14 @@
 		<form action="." method="post" class="form">
 		<form action="." method="post" class="form">
 		    {% csrf_token %}
 		    {% csrf_token %}
 		    {% render_form form %}
 		    {% render_form form %}
-		    <div class="form-group">
-		        <button type="submit" class="btn btn-primary">Submit</button>
-		        <a href="{{ return_url }}" class="btn btn-default">Cancel</a>
-		    </div>
+            <div class="form-group">
+                <div class="col-md-12 text-right">
+		            <button type="submit" class="btn btn-primary">Submit</button>
+		            {% if return_url %}
+                        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
+                    {% endif %}
+                </div>
+            </div>
 		</form>
 		</form>
 	</div>
 	</div>
 	<div class="col-md-6">
 	<div class="col-md-6">

+ 36 - 51
netbox/templates/tenancy/tenant_import.html

@@ -1,57 +1,42 @@
-{% extends '_base.html' %}
+{% extends 'utilities/obj_import.html' %}
 {% load render_table from django_tables2 %}
 {% load render_table from django_tables2 %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block title %}Tenant Import{% endblock %}
 {% block title %}Tenant Import{% endblock %}
 
 
-{% block content %}
-<h1>Tenant Import</h1>
-<div class="row">
-	<div class="col-md-6">
-		<form action="." method="post" class="form">
-		    {% csrf_token %}
-		    {% render_form form %}
-		    <div class="form-group">
-		        <button type="submit" class="btn btn-primary">Submit</button>
-		        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
-		    </div>
-		</form>
-	</div>
-	<div class="col-md-6">
-		<h4>CSV Format</h4>
-		<table class="table">
-			<thead>
-				<tr>
-					<th>Field</th>
-					<th>Description</th>
-					<th>Example</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>Name</td>
-					<td>Tenant name</td>
-					<td>WIDG01</td>
-				</tr>
-				<tr>
-					<td>Slug</td>
-					<td>URL-friendly name</td>
-					<td>widg01</td>
-				</tr>
-				<tr>
-					<td>Group</td>
-					<td>Tenant group (optional)</td>
-					<td>Customers</td>
-				</tr>
-				<tr>
-					<td>Description</td>
-					<td>Long-form name or other text (optional)</td>
-					<td>Widgets Inc.</td>
-				</tr>
-			</tbody>
-		</table>
-		<h4>Example</h4>
-		<pre>WIDG01,widg01,Customers,Widgets Inc.</pre>
-	</div>
-</div>
+{% block instructions %}
+    <h4>CSV Format</h4>
+    <table class="table">
+        <thead>
+            <tr>
+                <th>Field</th>
+                <th>Description</th>
+                <th>Example</th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr>
+                <td>Name</td>
+                <td>Tenant name</td>
+                <td>WIDG01</td>
+            </tr>
+            <tr>
+                <td>Slug</td>
+                <td>URL-friendly name</td>
+                <td>widg01</td>
+            </tr>
+            <tr>
+                <td>Group</td>
+                <td>Tenant group (optional)</td>
+                <td>Customers</td>
+            </tr>
+            <tr>
+                <td>Description</td>
+                <td>Long-form name or other text (optional)</td>
+                <td>Widgets Inc.</td>
+            </tr>
+        </tbody>
+    </table>
+    <h4>Example</h4>
+    <pre>WIDG01,widg01,Customers,Widgets Inc.</pre>
 {% endblock %}
 {% endblock %}

+ 34 - 0
netbox/templates/utilities/obj_import.html

@@ -0,0 +1,34 @@
+{% extends '_base.html' %}
+{% load render_table from django_tables2 %}
+{% load form_helpers %}
+
+{% block content %}
+<h1>{% block title %}{% endblock %}</h1>
+<div class="row">
+	<div class="col-md-6">
+        {% 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 %}
+		<form action="." method="post" class="form">
+		    {% csrf_token %}
+		    {% render_form form %}
+            <div class="form-group">
+                <div class="col-md-12 text-right">
+		            <button type="submit" class="btn btn-primary">Submit</button>
+		            {% if return_url %}
+                        <a href="{% url return_url %}" class="btn btn-default">Cancel</a>
+                    {% endif %}
+                </div>
+            </div>
+		</form>
+	</div>
+	<div class="col-md-6">
+        {% block instructions %}{% endblock %}
+	</div>
+</div>
+{% endblock %}