Skip to content

Commit

Permalink
Merge pull request #517 from peteeckel/feature/auto-serial-info
Browse files Browse the repository at this point in the history
Added the date/time equivalent to auto-generated SOA SERIALs in zone detail view
  • Loading branch information
peteeckel authored Jan 27, 2025
2 parents d218991 + effa4d5 commit 802c99f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
11 changes: 10 additions & 1 deletion netbox_dns/templates/netbox_dns/zone.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends 'netbox_dns/zone/base.html' %}
{% load helpers %}
{% load i18n %}
{% load netbox_dns %}
{% load tz %}

{% block content %}
<div class="row">
Expand Down Expand Up @@ -118,7 +120,14 @@ <h5 class="card-header">{% trans "Zone SOA" %}</h5>
{% if object.soa_serial_auto %}
<tr>
<th scope="row">{% trans "Serial (auto-generated)" %}</th>
<td>{{ object.soa_serial }}</td>
<td>
<table style="width: 100%;">
<tr>
<td>{{ object.soa_serial }}</td>
<td align="right" class="text-muted">{{ object.soa_serial|epoch_to_utc|isodatetime }}</td>
</tr>
</table>
</td>
</tr>
{% else %}
<tr>
Expand Down
Empty file.
10 changes: 10 additions & 0 deletions netbox_dns/templatetags/netbox_dns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from datetime import datetime, timezone

from django import template

register = template.Library()


@register.filter(name="epoch_to_utc")
def epoch_to_utc(epoch):
return datetime.fromtimestamp(epoch, tz=timezone.utc)

0 comments on commit 802c99f

Please sign in to comment.