From 39b65ceba07228d188a9659253448b2554ae00c8 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Fri, 31 May 2019 12:52:46 +0200 Subject: [PATCH] Add DS records to reverse zone --- domains/forms.py | 2 +- domains/models.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/domains/forms.py b/domains/forms.py index 744a920..4808387 100644 --- a/domains/forms.py +++ b/domains/forms.py @@ -210,7 +210,7 @@ class NameserverForm(MntFormMixin, WhoisObjectFormMixin, forms.ModelForm): return cleaned_data -class ReverseZoneForm(forms.ModelForm): +class ReverseZoneForm(DSRecordMixin, forms.ModelForm): prefix = forms.CharField(validators=[IP46CIDRValidator]) class Meta: diff --git a/domains/models.py b/domains/models.py index 16fd79a..b995466 100644 --- a/domains/models.py +++ b/domains/models.py @@ -13,6 +13,13 @@ import ipaddress # allow owners of a subnet to create reverse dns record? +class DSRecordModelMixin(models.Model): + class Meta: + abstract = True + + ds_records = models.TextField(blank=True, verbose_name='DS Records', + help_text='DS Records in the format of [id] [crypto-algo] [hash-algo] [hash]') + class Nameserver(MntdObject): handleSuffix = "NS" # dns name @@ -42,7 +49,7 @@ class Nameserver(MntdObject): return [] -class Domain(MntdObject): +class Domain(DSRecordModelMixin, MntdObject): handle = None handleSuffix = "DOM" name = models.CharField(max_length=67, unique=True, db_index=True) @@ -50,9 +57,6 @@ class Domain(MntdObject): nameservers = models.ManyToManyField(Nameserver, blank=True) admin_c = models.ManyToManyField(Contact) - ds_records = models.TextField(blank=True, verbose_name='DS Records', - help_text='DS Records in the format of [id] [crypto-algo] [hash-algo] [hash]') - def getPK(self): return self.name @@ -85,7 +89,7 @@ class Domain(MntdObject): return name.lower() -class ReverseZone(WhoisObject): +class ReverseZone(DSRecordModelMixin, WhoisObject): handle = None parentNet = models.ForeignKey(InetNum)