# Path: django_datawatch/defaults.py



import importlib
import logging
from celery.schedules import crontab
from django.conf import settings
from django.utils import timezone
from django.db import transaction
from django.db.models import signals
from django.utils.module_loading import autodiscover_modules
from django_datawatch.defaults import defaults
        from django_datawatch.models import Result
        from django_datawatch.models import CheckExecution
            return self._related_models[model_uid]
        return None

    def get_checks_for_model(self, model):
        check_classes = list()
        for check_class in datawatch.get_all_registered_checks():
            if check_class.model_class == model:
                check_classes.append(check_class)
        return check_classes

    def get_slug(self, module, class_name):
        return u'{}.{}'.format(module, class_name)

    def get_backend(self):
        if self._backend is None:
            backend_module = importlib.import_module(
                getattr(settings, 'DJANGO_DATAWATCH_BACKEND',
                        defaults['BACKEND']))
            self._backend = backend_module.Backend()
        return self._backend

    def delete_results(self, sender, instance):
        for check_class in datawatch.get_checks_for_model(model=sender):
            check = check_class()
            identifier = check.get_identifier(instance)
            Result.objects.filter(slug=check.slug, identifier=identifier).delete()

    def update_related(self, sender, instance):
        checks = datawatch.get_checks_for_related_model(sender) or []
        for check_class in checks:

# Path: django_datawatch/defaults.py



# Path: django_datawatch/datawatch.py
import importlib
import logging
from celery.schedules import crontab
from django.conf import settings
from django.utils import timezone
from django.db import transaction
from django.db.models import signals
from django.utils.module_loading import autodiscover_modules
from django_datawatch.defaults import defaults
        from django_datawatch.models import Result
        from django_datawatch.models import CheckExecution

            return self._related_models[model_uid]
        return None

    def get_checks_for_model(self, model):
        check_classes = list()
        for check_class in datawatch.get_all_registered_checks():
            if check_class.model_class == model:
                check_classes.append(check_class)
        return check_classes

    def get_slug(self, module, class_name):
        return u'{}.{}'.format(module, class_name)

    def get_backend(self):
        if self._backend is None:
            backend_module = importlib.import_module(
                getattr(settings, 'DJANGO_DATAWATCH_BACKEND',
                        defaults['BACKEND']))
            self._backend = backend_module.Backend()
        return self._backend

    def delete_results(self, sender, instance):
        for check_class in datawatch.get_checks_for_model(model=sender):
            check = check_class()
            identifier = check.get_identifier(instance)
            Result.objects.filter(slug=check.slug, identifier=identifier).delete()

    def update_related(self, sender, instance):
        checks = datawatch.get_checks_for_related_model(sender) or []
        for check_class in checks:

            check = check_class()