diff --git a/machines/migrations/0105_dname_ttl.py b/machines/migrations/0105_dname_ttl.py new file mode 100644 index 00000000..d3c38073 --- /dev/null +++ b/machines/migrations/0105_dname_ttl.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.23 on 2019-10-02 21:47 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('machines', '0104_auto_20191002_2231'), + ] + + operations = [ + migrations.AddField( + model_name='dname', + name='ttl', + field=models.PositiveIntegerField(default=172800, verbose_name='Time To Live (TTL)'), + ), + ] diff --git a/machines/models.py b/machines/models.py index 7b3c0dab..708dd8c9 100644 --- a/machines/models.py +++ b/machines/models.py @@ -915,6 +915,10 @@ class DName(RevMixin, AclMixin, models.Model): """A DNAME entry for the DNS.""" zone = models.ForeignKey('Extension', on_delete=models.PROTECT) alias = models.CharField(max_length=255) + ttl = models.PositiveIntegerField( + verbose_name=_("Time To Live (TTL)"), + default=172800, # 2 days + ) class Meta: permissions = ( diff --git a/machines/templates/machines/aff_dname.html b/machines/templates/machines/aff_dname.html index 6d07a7bc..4073a388 100644 --- a/machines/templates/machines/aff_dname.html +++ b/machines/templates/machines/aff_dname.html @@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% trans "Target zone" %} {% trans "Record" %} + {% trans "TTL" %} @@ -36,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ dname.zone }} {{ dname.dns_entry }} + {{ dname.ttl }} {% can_edit dname %} {% include 'buttons/edit.html' with href='machines:edit-dname' id=dname.id %}