コード例 #1
0
ファイル: admin_modify.py プロジェクト: cheekybastard/pops
def submit_row(context):
    from django.contrib.admin.templatetags.admin_modify import (
        submit_row as django_submit_row)
    new_context = copy(context)
    new_context.update(django_submit_row(context))

    # TODO: test this
    buttons = {"primary_button": {}, "secondary_buttons": [], }
    if not getattr(settings, "POPS_SUBMIT_BUTTONS", False):
        if new_context["show_save_and_continue"]:
            buttons["primary_button"] = BUTTONS["save_and_continue"]
        else:
            buttons["primary_button"] = BUTTONS["save"]
        if new_context["show_save_and_add_another"]:
            buttons["secondary_buttons"].append(BUTTONS["save_and_add_another"])
        if new_context["show_save_as_new"]:
            buttons["secondary_buttons"].append(BUTTONS["save_as_new"])
        if new_context["show_save_and_continue"]:
            buttons["secondary_buttons"].append(BUTTONS["save"])
    else:
        configured_buttons = settings.POPS_SUBMIT_BUTTONS
        if type(configured_buttons) is list:
            buttons["primary_button"] = BUTTONS[configured_buttons[0]]
            buttons["secondary_buttons"] = [
                    BUTTONS[a] for a in configured_buttons[1:]
                    if new_context["show_%s" % a]]
        else:
            buttons = configured_buttons
    new_context["buttons"] = buttons
    return new_context
コード例 #2
0
ファイル: admin_modify.py プロジェクト: texastribune/pops
def submit_row(context):
    from django.contrib.admin.templatetags.admin_modify import (
        submit_row as django_submit_row)
    new_context = copy(context)
    new_context.update(django_submit_row(context))

    # TODO: test this
    buttons = {
        "primary_button": {},
        "secondary_buttons": [],
    }
    if not getattr(settings, "POPS_SUBMIT_BUTTONS", False):
        if new_context["show_save_and_continue"]:
            buttons["primary_button"] = BUTTONS["save_and_continue"]
        else:
            buttons["primary_button"] = BUTTONS["save"]
        if new_context["show_save_and_add_another"]:
            buttons["secondary_buttons"].append(
                BUTTONS["save_and_add_another"])
        if new_context["show_save_as_new"]:
            buttons["secondary_buttons"].append(BUTTONS["save_as_new"])
        if new_context["show_save_and_continue"]:
            buttons["secondary_buttons"].append(BUTTONS["save"])
    else:
        configured_buttons = settings.POPS_SUBMIT_BUTTONS
        if type(configured_buttons) is list:
            buttons["primary_button"] = BUTTONS[configured_buttons[0]]
            buttons["secondary_buttons"] = [
                BUTTONS[a] for a in configured_buttons[1:]
                if new_context["show_%s" % a]
            ]
        else:
            buttons = configured_buttons
    new_context["buttons"] = buttons
    return new_context
コード例 #3
0
def edc_submit_row(context):
    request = context.get('request')
    if int(request.site.id) == int(context.get('reviewer_site_id')):
        context['show_save'] = False
        context['show_delete'] = False
        context['show_save_next'] = False
    return django_submit_row(context)
コード例 #4
0
def edc_submit_row(context):

    request = get_request_object(context)
    if request:
        if int(request.site.id) == int(context.get("reviewer_site_id", 0)):
            context.update({"save_next": None})
            context.update({"show_delete": None})

    show_save = context.get("show_save")
    if "save_next" in context:
        context["save_next"] = show_save

    if "show_cancel" in context:
        context["cancel_url"] = get_cancel_url(context)

    return django_submit_row(context)
コード例 #5
0
ファイル: demo_tags.py プロジェクト: diego1996/SAP
def submit_row_custom(context):
    """
    Currently only way of overriding Django admin submit_line.html is by replacing
    submit_row template tag in change_form.html
    """
    return django_submit_row(context)
コード例 #6
0
ファイル: admin_modify.py プロジェクト: ucabgao/Experiment7
def submit_row(context):
    from django.contrib.admin.templatetags.admin_modify import (
        submit_row as django_submit_row)
    new_context = copy(context)
    new_context.update(django_submit_row(context))
    return new_context