Beispiel #1
0
def get_delete_context_dict(request, model, object_uuid, default_cancel='/'):
    """ Returns a dict of the values needed by the confirm delete view. """
    obj = get_object_or_404(model, uuid=object_uuid)
    header = _('Confirm deleting %(item)s') % {'item': model._meta.verbose_name}
    dependent_objects = utils.dependent_objects(obj)
    if dependent_objects:
        prompt = _('%(item)s cannot be deleted until the following items are also deleted or unassociated.') % {'item': obj}
    else:
        prompt = _('Are you sure you want to delete {item}?') % {'item': obj}
    cancel_url = request.GET.get('next', default_cancel)
    return {
        'header': header,
        'dependent_objects': dependent_objects,
        'prompt': prompt,
        'cancel_url': cancel_url,
    }
Beispiel #2
0
def get_delete_context_dict(request, model, object_uuid, default_cancel="/"):
    """ Returns a dict of the values needed by the confirm delete view. """
    obj = get_object_or_404(model, uuid=object_uuid)
    header = _("Confirm deleting %(item)s") % {"item": model._meta.verbose_name}
    dependent_objects = utils.dependent_objects(obj)
    if dependent_objects:
        prompt = _(
            "%(item)s cannot be deleted until the following items are also deleted or unassociated."
        ) % {"item": obj}
    else:
        prompt = _("Are you sure you want to delete {item}?") % {"item": obj}
    cancel_url = request.GET.get("next", default_cancel)
    return {
        "header": header,
        "dependent_objects": dependent_objects,
        "prompt": prompt,
        "cancel_url": cancel_url,
    }