Beispiel #1
0
def delete_related_documents_task(app_label, object_name, instance_id):
    instance = _instance(app_label, object_name, instance_id)
    registry.delete_related(instance)
    return {
        'app': app_label,
        'model': object_name,
        'instance_id': instance_id
    }
Beispiel #2
0
def delete_with_related_task(app_label, object_name, instance_id):
    instance = _instance(app_label, object_name, instance_id)
    registry.delete_related(instance)
    registry.delete(instance, raise_on_error=False)
    return {
        'app': app_label,
        'model': object_name,
        'instance_id': instance_id
    }
Beispiel #3
0
def search_instance_pre_delete(model_name, pk):
    try:
        instance = get_instance(model_name, pk)
        registry.delete_related(instance)
    except Exception as e:
        logger.exception(e)
Beispiel #4
0
def __handle_pre_delete(instance):
    registry.delete_related(instance)
Beispiel #5
0
def handle_pre_delete(pk,  app_label, model_name):
    sender = apps.get_model(app_label, model_name)
    instance = sender.objects.get(pk=pk)
    registry.delete_related(instance)
Beispiel #6
0
 def handle_pre_delete(self, sender, instance, **kwargs):
     """Handle removing of instance object from related models instance.
     We need to do this before the real delete otherwise the relation
     doesn't exists anymore and we can't get the related models instance.
     """
     registry.delete_related(instance)