Merge "Add option for records pointing to domain"
This commit is contained in:
commit
5627ddb4a6
@ -395,9 +395,9 @@ class RecordForm(forms.SelfHandlingForm):
|
||||
|
||||
# Name field
|
||||
if self._is_field_blank(cleaned_data, 'name'):
|
||||
if record_type in ['A', 'AAAA', 'CNAME', 'SRV', 'TXT', 'PTR']:
|
||||
if record_type in ['CNAME', 'SRV', 'PTR']:
|
||||
self._add_required_field_error('name')
|
||||
elif record_type == 'MX':
|
||||
elif record_type in ['MX', 'A', 'AAAA', 'TXT']:
|
||||
cleaned_data['name'] = domain_name
|
||||
else:
|
||||
if record_type == 'SRV':
|
||||
|
@ -100,7 +100,8 @@ class ARecordFormTests(base.BaseRecordFormCleanTests):
|
||||
def test_missing_name_field(self):
|
||||
self.form.cleaned_data['name'] = ''
|
||||
self.form.clean()
|
||||
self.assert_required_error('name')
|
||||
self.assert_no_errors()
|
||||
self.assertIsNotNone(self.form.cleaned_data['name'])
|
||||
|
||||
def test_missing_data_field(self):
|
||||
self.form.cleaned_data['data'] = ''
|
||||
@ -162,7 +163,8 @@ class AAAARecordFormTests(base.BaseRecordFormCleanTests):
|
||||
def test_missing_name_field(self):
|
||||
self.form.cleaned_data['name'] = ''
|
||||
self.form.clean()
|
||||
self.assert_required_error('name')
|
||||
self.assert_no_errors()
|
||||
self.assertIsNotNone(self.form.cleaned_data['name'])
|
||||
|
||||
def test_missing_data_field(self):
|
||||
self.form.cleaned_data['data'] = ''
|
||||
@ -317,7 +319,8 @@ class TXTRecordFormTests(base.BaseRecordFormCleanTests):
|
||||
def test_missing_name_field(self):
|
||||
self.form.cleaned_data['name'] = ''
|
||||
self.form.clean()
|
||||
self.assert_required_error('name')
|
||||
self.assert_no_errors()
|
||||
self.assertIsNotNone(self.form.cleaned_data['name'])
|
||||
|
||||
def test_missing_txt_field(self):
|
||||
self.form.cleaned_data['txt'] = ''
|
||||
|
Loading…
Reference in New Issue
Block a user