Use hasattr(self, 'customers') to avoid the exception check as recommended in Django docs:
def has_related_object(self):
return hasattr(self, 'customers') and self.car is not None
Use hasattr(self, 'customers') to avoid the exception check as recommended in Django docs:
def has_related_object(self):
return hasattr(self, 'customers') and self.car is not None