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
1 changed files with 3 additions and 2 deletions

View File

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