I have a method has_related_object in my model that needs to check if a related object exists
has_related_object
class Business(base): name = models.CharField(ma
Use hasattr(self, 'customers') to avoid the exception check as recommended in Django docs:
hasattr(self, 'customers')
def has_related_object(self): return hasattr(self, 'customers') and self.car is not None