Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions netbox_dns/models/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ def is_address_record(self):
def is_ptr_record(self):
return self.type == RecordTypeChoices.PTR

@property
def rrset(self):
return self.zone.records.filter(type=self.type, name=self.name)

@property
def rfc2317_ptr_name(self):
return self.value.split(".")[-1]
Expand Down
12 changes: 12 additions & 0 deletions netbox_dns/templates/netbox_dns/record.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@ <h5 class="card-header">{% trans "Record" %}</h5>
</tr>
</table>
</div>
{% if rrset_record_table %}
<div class="card">
{% if rrset_record_table.rows|length == 1 %}
<h5 class="card-header">{% trans "Other Record in the RRSET" %}</h5>
{% else %}
<h5 class="card-header">{% trans "Other Records in the RRSET" %}</h5>
{% endif %}
<div class="table-responsive">
{% render_table rrset_record_table 'inc/table.html' %}
</div>
</div>
{% endif %}
{% if cname_target_table %}
<div class="card">
{% if cname_target_table.rows|length == 1 %}
Expand Down
8 changes: 8 additions & 0 deletions netbox_dns/views/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ def get_extra_context(self, request, instance):
if address_record is not None:
context["ipam_ip_address"] = address_record.ipam_ip_address

if instance.rrset.count() > 1:
rrset_record_table = RelatedRecordTable(
data=instance.rrset.exclude(pk=instance.pk)
)
rrset_record_table.configure(request)

context["rrset_record_table"] = rrset_record_table

if not instance.managed:
try:
instance.check_zone_cut_conflict()
Expand Down
Loading