Added CBVs for RIRs

This commit is contained in:
Jeremy Stretch
2016-05-16 13:04:45 -04:00
parent b481935b9a
commit e1a0b8fee6
8 changed files with 129 additions and 7 deletions
+6 -1
View File
@@ -101,7 +101,7 @@
{% endif %}
</ul>
</li>
<li class="dropdown{% if '/ipam/ip-addresses/' in request.path or '/prefixes/' in request.path or '/aggregates/' in request.path %} active{% endif %}">
<li class="dropdown{% if '/ipam/ip-addresses/' in request.path or '/prefixes/' in request.path or '/aggregates/' in request.path or '/vrfs/' in request.path or '/rirs/' in request.path %} active{% endif %}">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">IP Space <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{% url 'ipam:ipaddress_list' %}"><i class="glyphicon glyphicon-search" aria-hidden="true"></i> IP Addresses</a></li>
@@ -133,6 +133,11 @@
<li><a href="{% url 'ipam:vrf_add' %}"><i class="glyphicon glyphicon-plus" aria-hidden="true"></i> Add a VRF</a></li>
<li><a href="{% url 'ipam:vrf_import' %}"><i class="glyphicon glyphicon-import" aria-hidden="true"></i> Import VRFs</a></li>
{% endif %}
<li class="divider"></li>
<li><a href="{% url 'ipam:rir_list' %}"><i class="glyphicon glyphicon-search" aria-hidden="true"></i> RIRs</a></li>
{% if perms.ipam.add_rir %}
<li><a href="{% url 'ipam:rir_add' %}"><i class="glyphicon glyphicon-plus" aria-hidden="true"></i> Add a RIR</a></li>
{% endif %}
</ul>
</li>
<li class="dropdown{% if '/vlans/' in request.path %} active{% endif %}">
+14
View File
@@ -0,0 +1,14 @@
{% load render_table from django_tables2 %}
{% if perms.ipam.delete_rir %}
<form method="post" class="form form-horizontal">
{% csrf_token %}
<input type="hidden" name="redirect_url" value="{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" />
{% render_table table table_template|default:'table.html' %}
<button type="submit" name="_delete" formaction="{% url 'ipam:rir_bulk_delete' %}" class="btn btn-danger btn-sm">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
Delete Selected
</button>
</form>
{% else %}
{% render_table table table_template|default:'table.html' %}
{% endif %}
+21
View File
@@ -0,0 +1,21 @@
{% extends '_base.html' %}
{% load helpers %}
{% block title %}RIRs{% endblock %}
{% block content %}
<div class="pull-right">
{% if perms.dcim.add_devicerole %}
<a href="{% url 'ipam:rir_add' %}" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
Add a RIR
</a>
{% endif %}
</div>
<h1>RIRs</h1>
<div class="row">
<div class="col-md-12">
{% include 'ipam/inc/rir_table.html' %}
</div>
</div>
{% endblock %}