From c8554ac635ecbe60752f0cb5cb0b489e18fc451f Mon Sep 17 00:00:00 2001 From: Hugo Levy-Falk Date: Fri, 20 Sep 2019 11:37:49 +0200 Subject: [PATCH] Fix #212 --- api/serializers.py | 2 +- .../0063_optionalmachine_dns_ttl.py | 20 +++++++++++++++++++ preferences/models.py | 4 ++++ .../preferences/display_preferences.html | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 preferences/migrations/0063_optionalmachine_dns_ttl.py diff --git a/api/serializers.py b/api/serializers.py index eabcc73a..29737374 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -381,7 +381,7 @@ class OptionalMachineSerializer(NamespacedHMSerializer): model = preferences.OptionalMachine fields = ('password_machine', 'max_lambdauser_interfaces', 'max_lambdauser_aliases', 'ipv6_mode', 'create_machine', - 'ipv6') + 'ipv6', 'dns_ttl') class OptionalTopologieSerializer(NamespacedHMSerializer): diff --git a/preferences/migrations/0063_optionalmachine_dns_ttl.py b/preferences/migrations/0063_optionalmachine_dns_ttl.py new file mode 100644 index 00000000..3891bf73 --- /dev/null +++ b/preferences/migrations/0063_optionalmachine_dns_ttl.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.23 on 2019-09-20 09:32 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('preferences', '0062_auto_20190910_1909'), + ] + + operations = [ + migrations.AddField( + model_name='optionalmachine', + name='dns_ttl', + field=models.IntegerField(default=86400, verbose_name='Time To Live for DNS records'), + ), + ] diff --git a/preferences/models.py b/preferences/models.py index af85847b..52b31e9b 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -173,6 +173,10 @@ class OptionalMachine(AclMixin, PreferencesModel): create_machine = models.BooleanField( default=True ) + dns_ttl = models.IntegerField( + default=86400, + verbose_name=_("Time To Live for DNS records") + ) @cached_property def ipv6(self): diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html index 99ee9be3..96e37d31 100644 --- a/preferences/templates/preferences/display_preferences.html +++ b/preferences/templates/preferences/display_preferences.html @@ -183,6 +183,8 @@ with this program; if not, write to the Free Software Foundation, Inc., {% trans "Creation of machines" %} {{ machineoptions.create_machine|tick }} + {% trans "Time To Live for DNS records" %} + {{ machineoptions.dns_ttl }}