Converted IPAM VRF, Aggregate add/edit/delete views to CBVs

This commit is contained in:
Jeremy Stretch
2016-05-09 12:20:46 -04:00
parent 606255e1ab
commit 60daaee204
6 changed files with 62 additions and 157 deletions

View File

@@ -1,8 +1,8 @@
{% extends 'utilities/confirmation_form.html' %}
{% load form_helpers %}
{% block title %}Delete aggregate {{ aggregate }}?{% endblock %}
{% block title %}Delete aggregate {{ obj }}?{% endblock %}
{% block message %}
<p>Are you sure you want to delete this aggregate?</p>
<p>Are you sure you want to delete {{ obj }}?</p>
{% endblock %}

View File

@@ -1,11 +1,11 @@
{% extends '_base.html' %}
{% load form_helpers %}
{% block title %}Editing aggregate {{ aggregate }}{% endblock %}
{% block title %}{% if obj %}Editing aggregate {{ obj }}{% else %}Add a new aggregate{% endif %}{% endblock %}
{% block content %}
{% if aggregate %}
<h1>{{ aggregate }}</h1>
{% if obj %}
<h1>{{ obj }}</h1>
{% else %}
<h1>Add an Aggregate</h1>
{% endif %}
@@ -32,9 +32,9 @@
</div>
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
{% if aggregate %}
{% if obj %}
<button type="submit" name="_update" class="btn btn-primary">Update</button>
<a href="{% url 'ipam:aggregate' pk=aggregate.pk %}" class="btn btn-default">Cancel</a>
<a href="{% url 'ipam:aggregate' pk=obj.pk %}" class="btn btn-default">Cancel</a>
{% 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>

View File

@@ -1,20 +1,20 @@
{% extends 'utilities/confirmation_form.html' %}
{% load form_helpers %}
{% block title %}Delete VRF {{ vrf }}?{% endblock %}
{% block title %}Delete VRF {{ obj }}?{% endblock %}
{% block message %}
<p>
Are you sure you want to delete this VRF?
{% if vrf.prefix_set.count %}
{% if obj.prefix_set.count %}
The following prefixes will also be deleted:
{% else %}
(There are no prefixes associated with this VRF.)
{% endif %}
</p>
{% if vrf.prefix_set.count %}
{% if obj.prefix_set.count %}
<ul>
{% for p in vrf.prefix_set.all %}
{% for p in obj.prefix_set.all %}
<li><a href="{% url 'ipam:prefix' pk=p.pk %}">{{ p }}</a></li>
{% endfor %}
</ul>

View File

@@ -1,11 +1,11 @@
{% extends '_base.html' %}
{% load form_helpers %}
{% block title %}{% if vrf %}Editing VRF {{ vrf }}{% else %}Add a VRF{% endif %}{% endblock %}
{% block title %}{% if obj %}Editing VRF {{ obj }}{% else %}Add a VRF{% endif %}{% endblock %}
{% block content %}
{% if vrf %}
<h1>{{ vrf }}</h1>
{% if obj %}
<h1>{{ obj }}</h1>
{% else %}
<h1>Add a VRF</h1>
{% endif %}
@@ -29,9 +29,9 @@
</div>
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
{% if vrf %}
{% if obj %}
<button type="submit" name="_update" class="btn btn-primary">Update</button>
<a href="{% url 'ipam:vrf' pk=vrf.pk %}" class="btn btn-default">Cancel</a>
<a href="{% url 'ipam:vrf' pk=obj.pk %}" class="btn btn-default">Cancel</a>
{% 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>