Browse Source

Add DS records to reverse zone

Sebastian Lohff 1 year ago
parent
commit
39b65ceba0
2 changed files with 10 additions and 6 deletions
  1. 1
    1
      domains/forms.py
  2. 9
    5
      domains/models.py

+ 1
- 1
domains/forms.py View File

@@ -210,7 +210,7 @@ class NameserverForm(MntFormMixin, WhoisObjectFormMixin, forms.ModelForm):
210 210
         return cleaned_data
211 211
 
212 212
 
213
-class ReverseZoneForm(forms.ModelForm):
213
+class ReverseZoneForm(DSRecordMixin, forms.ModelForm):
214 214
     prefix = forms.CharField(validators=[IP46CIDRValidator])
215 215
 
216 216
     class Meta:

+ 9
- 5
domains/models.py View File

@@ -13,6 +13,13 @@ import ipaddress
13 13
 # allow owners of a subnet to create reverse dns record?
14 14
 
15 15
 
16
+class DSRecordModelMixin(models.Model):
17
+    class Meta:
18
+        abstract = True
19
+
20
+    ds_records = models.TextField(blank=True, verbose_name='DS Records',
21
+                                  help_text='DS Records in the format of [id] [crypto-algo] [hash-algo] [hash]')
22
+
16 23
 class Nameserver(MntdObject):
17 24
     handleSuffix = "NS"
18 25
     # dns name
@@ -42,7 +49,7 @@ class Nameserver(MntdObject):
42 49
         return []
43 50
 
44 51
 
45
-class Domain(MntdObject):
52
+class Domain(DSRecordModelMixin, MntdObject):
46 53
     handle = None
47 54
     handleSuffix = "DOM"
48 55
     name = models.CharField(max_length=67, unique=True, db_index=True)
@@ -50,9 +57,6 @@ class Domain(MntdObject):
50 57
     nameservers = models.ManyToManyField(Nameserver, blank=True)
51 58
     admin_c = models.ManyToManyField(Contact)
52 59
 
53
-    ds_records = models.TextField(blank=True, verbose_name='DS Records',
54
-                                  help_text='DS Records in the format of [id] [crypto-algo] [hash-algo] [hash]')
55
-
56 60
     def getPK(self):
57 61
         return self.name
58 62
 
@@ -85,7 +89,7 @@ class Domain(MntdObject):
85 89
         return name.lower()
86 90
 
87 91
 
88
-class ReverseZone(WhoisObject):
92
+class ReverseZone(DSRecordModelMixin, WhoisObject):
89 93
     handle = None
90 94
 
91 95
     parentNet = models.ForeignKey(InetNum)

Loading…
Cancel
Save