Commits

George Notaras  committed 4dea676

Implemented MX record validation.

  • Participants
  • Parent commits 73f3076

Comments (0)

Files changed (1)

File src/powerdns_manager/forms.py

 class MxRecordModelForm(BaseRecordModelForm):
     """ModelForm for MX resource records."""
 
+    def clean_name(self):
+        name = self.cleaned_data.get('name')
+        validate_hostname(name, supports_wildcard=True)
+        return name
+    
+    def clean_content(self):
+        content = self.cleaned_data.get('content')
+        validate_hostname(content)
+        return content
+    
     def save(self, *args, **kwargs):
         self.instance.type = 'MX'
         return super(MxRecordModelForm, self).save(*args, **kwargs)