mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Added CBVs for RIRs
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import django_tables2 as tables
|
||||
from django_tables2.utils import Accessor
|
||||
|
||||
from .models import Aggregate, Prefix, IPAddress, VLAN, VRF
|
||||
from .models import VRF, RIR, Aggregate, Prefix, IPAddress, VLAN
|
||||
|
||||
|
||||
RIR_EDIT_LINK = """
|
||||
{% if perms.ipam.change_rir %}<a href="{% url 'ipam:rir_edit' slug=record.slug %}">Edit</a>{% endif %}
|
||||
"""
|
||||
|
||||
UTILIZATION_GRAPH = """
|
||||
{% with record.get_utilization as percentage %}
|
||||
<div class="progress text-center">
|
||||
@@ -59,6 +63,26 @@ class VRFTable(tables.Table):
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# RIRs
|
||||
#
|
||||
|
||||
class RIRTable(tables.Table):
|
||||
pk = tables.CheckBoxColumn(visible=False, default='')
|
||||
name = tables.LinkColumn(verbose_name='Name')
|
||||
aggregate_count = tables.Column(verbose_name='Aggregates')
|
||||
slug = tables.Column(verbose_name='Slug')
|
||||
edit = tables.TemplateColumn(template_code=RIR_EDIT_LINK, verbose_name='')
|
||||
|
||||
class Meta:
|
||||
model = RIR
|
||||
fields = ('pk', 'name', 'aggregate_count', 'slug', 'edit')
|
||||
empty_text = "No aggregates were found."
|
||||
attrs = {
|
||||
'class': 'table table-hover',
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Aggregates
|
||||
#
|
||||
|
Reference in New Issue
Block a user