

def delete(self, *args, **kwargs):
    if self.site_set.all().exists():
        raise ValidationError('This site has child sites. You cannot delete it.')
    super(Site, self).delete(*args, **kwargs)

dataset/ETHPy150Open mozilla/inventory/core/site/models.py Site.delete/original