Follow-up Ibddffc5f: Also allow PTR records pointing to the domain itself

Bug: #1597989
Change-Id: Ie13e47e03afd4e95621bfb5f36b8e79e78643b11
This commit is contained in:
Alex Monk 2016-08-10 19:12:27 +01:00
parent 2669ea575d
commit 3afaf1ff64
2 changed files with 4 additions and 3 deletions

View File

@ -395,9 +395,9 @@ class RecordForm(forms.SelfHandlingForm):
# Name field
if self._is_field_blank(cleaned_data, 'name'):
if record_type in ['CNAME', 'SRV', 'PTR']:
if record_type in ['CNAME', 'SRV']:
self._add_required_field_error('name')
elif record_type in ['MX', 'A', 'AAAA', 'TXT']:
elif record_type in ['MX', 'A', 'AAAA', 'TXT', 'PTR']:
cleaned_data['name'] = domain_name
else:
if record_type == 'SRV':

View File

@ -37,7 +37,8 @@ class PTRRecordFormTests(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_invalid_name_field(self):
self.form.cleaned_data['name'] = '#@$foo!!'