Handle empty address on Server.clean()
This commit is contained in:
parent
48ef1f21e3
commit
7183174f4c
|
@ -51,8 +51,9 @@ class Server(models.Model):
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
self.name = self.name.strip()
|
self.name = self.name.strip()
|
||||||
|
if self.address:
|
||||||
self.address = self.address.strip()
|
self.address = self.address.strip()
|
||||||
if self.name and not self.address:
|
elif self.name:
|
||||||
validate = OrValidator(validate_ip_address, validate_hostname)
|
validate = OrValidator(validate_ip_address, validate_hostname)
|
||||||
validate_hostname(self.name)
|
validate_hostname(self.name)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue