'This method registers the delete rules to apply when removing this
object.'

@classmethod
def register_delete_rule(cls, document_cls, field_name, rule):

    classes = ([get_document(class_name) for class_name in cls._subclasses if (class_name != cls.__name__)] + [cls])
    documents = ([get_document(class_name) for class_name in document_cls._subclasses if (class_name != document_cls.__name__)] + [document_cls])
    for klass in classes:
        for document_cls in documents:
            delete_rules = (klass._meta.get('delete_rules') or {})
            delete_rules[(document_cls, field_name)] = rule
            klass._meta['delete_rules'] = delete_rules
