Added CBVs for Platforms

This commit is contained in:
Jeremy Stretch
2016-05-16 11:54:17 -04:00
parent 4007b40eac
commit a07aa69321
8 changed files with 130 additions and 14 deletions
+5
View File
@@ -71,6 +71,11 @@
{% if perms.dcim.add_manufacturer %}
<li><a href="{% url 'dcim:manufacturer_add' %}"><i class="glyphicon glyphicon-plus" aria-hidden="true"></i> Add a Manufacturer</a></li>
{% endif %}
<li class="divider"></li>
<li><a href="{% url 'dcim:platform_list' %}"><i class="glyphicon glyphicon-search" aria-hidden="true"></i> Platforms</a></li>
{% if perms.dcim.add_platform %}
<li><a href="{% url 'dcim:platform_add' %}"><i class="glyphicon glyphicon-plus" aria-hidden="true"></i> Add a Platform</a></li>
{% endif %}
</ul>
</li>
<li class="dropdown{% if '-connections/' in request.path %} active{% endif %}">
@@ -0,0 +1,14 @@
{% load render_table from django_tables2 %}
{% if perms.dcim.delete_platform %}
<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 'dcim:platform_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 %}Platforms{% endblock %}
{% block content %}
<div class="pull-right">
{% if perms.dcim.add_platform %}
<a href="{% url 'dcim:platform_add' %}" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
Add a platform
</a>
{% endif %}
</div>
<h1>Platforms</h1>
<div class="row">
<div class="col-md-12">
{% include 'dcim/inc/platform_table.html' %}
</div>
</div>
{% endblock %}