Handle empty address on Server.clean()

This commit is contained in:
Santiago L 2021-05-13 10:57:48 +02:00
parent 48ef1f21e3
commit 7183174f4c

View file

@ -51,8 +51,9 @@ class Server(models.Model):
def clean(self):
self.name = self.name.strip()
if self.address:
self.address = self.address.strip()
if self.name and not self.address:
elif self.name:
validate = OrValidator(validate_ip_address, validate_hostname)
validate_hostname(self.name)
try: