rename domain_blacklist_validator to host_blacklist_validator

This commit is contained in:
Thomas Waldmann 2014-09-21 22:48:51 +02:00
parent 522911f6f8
commit a064ba1961

View File

@ -45,7 +45,7 @@ class BlacklistedHost(models.Model):
return u"%s" % (self.name_re, ) return u"%s" % (self.name_re, )
def domain_blacklist_validator(value): def host_blacklist_validator(value):
for bd in BlacklistedHost.objects.all(): for bd in BlacklistedHost.objects.all():
if re.search(bd.name_re, value): if re.search(bd.name_re, value):
raise ValidationError(u'This name is blacklisted') raise ValidationError(u'This name is blacklisted')
@ -129,7 +129,7 @@ class Host(models.Model):
regex=r'^(([a-z0-9][a-z0-9\-]*[a-z0-9])|[a-z0-9])$', regex=r'^(([a-z0-9][a-z0-9\-]*[a-z0-9])|[a-z0-9])$',
message='Invalid host name: only "a-z", "0-9" and "-" is allowed' message='Invalid host name: only "a-z", "0-9" and "-" is allowed'
), ),
domain_blacklist_validator, host_blacklist_validator,
], ],
help_text=_("The name of your host.")) help_text=_("The name of your host."))
domain = models.ForeignKey(Domain, on_delete=models.CASCADE) domain = models.ForeignKey(Domain, on_delete=models.CASCADE)