Esempio n. 1
0
def submit_row(context):
    """Identical to admin_modify's submit_row, save that we use a different
    template and add an extra context value."""
    context = original_submit_row(context)
    # Extension point for future permissions checks, if desired
    context['show_save_then_doc'] = True
    return original_submit_row(context)
Esempio n. 2
0
def submit_row(context):
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another': context.get('show_save_and_add_another', ctx['show_save_and_add_another']),
        'show_save_and_continue': context.get('show_save_and_continue', ctx['show_save_and_continue'])
        })
    return ctx
Esempio n. 3
0
def submit_row(context):
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another': context.get('show_save_and_add_another', ctx['show_save_and_add_another']),
        'show_save_and_continue': context.get('show_save_and_continue', ctx['show_save_and_continue']),
        'show_save': context.get('show_save', ctx['show_save'])})
    return ctx
Esempio n. 4
0
def submit_row(context):
    ctx = original_submit_row(context)
    ctx.update({
        'show_edit_edge_image': context.get('show_edit_edge_image', False),
        'edit_edge_image_url_prefix': context.get('edit_edge_image_url_prefix', '/admin/contour/edge_image/'),
    })
    return ctx
Esempio n. 5
0
def submit_row(context):  # NEF-8
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another': False,
        'show_save_and_continue': False
    })
    return ctx
def submit_row(context):
    """
    Add some things in the submit row context
    """
    ctx = original_submit_row(context)
    prefill = ""
    original = context.get('original')
    show_trigger_build = False
    show_trigger_relay = False
    if original and isinstance(original, WebHookMapping):
        show_trigger_build = True
        prefill = "?"
        data = model_to_dict(original, fields=[], exclude=[])
        for key, value in data.items():
            if value is False:
                value = ""
            prefill += "%s=%s&" % (key, value)
        if original.revision:
            prefill += "revision=%s" % (original.revision)
    elif original and isinstance(original, RelayTarget):
        show_trigger_relay = True

    ctx.update({
        'show_trigger_build': show_trigger_build,
        'show_trigger_relay': show_trigger_relay,
        'prefill': prefill,
    })
    return ctx
Esempio n. 7
0
def submit_row(context):
    ctx = original_submit_row(context)
    # print "ctx--->", ctx
    ctx.update({
        'show_save_and_add_another': False ,#context.get('show_save_and_add_another', ctx['show_save_and_add_another']),
        'show_save_and_continue': False
        })                                                                  
    return ctx
Esempio n. 8
0
def submit_row(context):
    '''
        删除"保存后添加"按钮
    '''
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another': False,
    })                                                                  
    return ctx 
Esempio n. 9
0
def submit_row(context):
    ctx = original_submit_row(context)
    ctx.update({
        'show_save': context.get('show_save', ctx['show_save']),
        'show_save_and_add_another': context.get('show_save_and_add_another', ctx['show_save_and_add_another']),
        'show_save_and_continue': context.get('show_save_and_continue', ctx['show_save_and_continue']),
        'custom_delete_url': context.get("custom_delete_url",None),
        })                                                                  
    return ctx 
Esempio n. 10
0
def submit_row(context):
    """
        Delete "Save Add" button
    """
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another': False,
    })
    return ctx
Esempio n. 11
0
def submit_row(context):
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another': False, # Never show that button
        'show_save_and_continue': context.get('archived_mode_enabled', ctx['show_save_and_continue']), # Hide if archived
        'show_save': context.get('archived_mode_enabled', ctx['show_save']), # Hide if archived
        'show_delete_link': not (context.get('archived_mode_enabled', False) or context.get('archived_mode_disabled', False)) # Hide delete button if archive enabled
    })
    return ctx
Esempio n. 12
0
def submit_row(context):
    """
        删除"保存后添加"按钮
    """
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another': False,
    })
    return ctx
Esempio n. 13
0
def submit_row(context):
    print 'xxxctxxxxxxxxxxxxx'
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another': context.get('show_save_and_add_another', ctx['show_save_and_add_another']),
        'show_save_and_continue': context.get('show_save_and_continue', ctx['show_save_and_continue']),
        'xxxx':'bbb',
        })                                                                  
    print ctx
    return ctx 
Esempio n. 14
0
def submit_row(context):
    """
    Takes the default submit_row context.  Override this context in
    order to add the new property "can_archive." Return the updated
    context.
    """
    ctx = original_submit_row(context)
    ctx.update({
        'can_archive': context.get('can_archive'),
    })
    return ctx
Esempio n. 15
0
    def submit_row(context):
        ctx = original_submit_row(context)

        user = context['request'].user
        if user.is_staff and not user.is_superuser:
            ctx.update({
                'show_save_and_add_another': False,
                'show_save_and_continue': False,
                'show_save': False,
                'show_save_as_new': False,
            })
        return ctx
Esempio n. 16
0
def submit_row(context):
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_continue': context.get('show_save_and_continue', ctx['show_save_and_continue']),
        'show_abandon': context.get('show_abandon'),
        'show_accept': context.get('show_accept'),
        'show_preview': context.get('show_preview'),
        'show_submit': context.get('show_submit'),
        'show_back': context.get('show_back'),
        'show_publish': context.get('show_publish')
    })
    return ctx
Esempio n. 17
0
def get_ctx(context):
    ''' submit buttons context change '''
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another': context.get('show_save_and_add_another',
                                                 ctx['show_save_and_add_another']),
        'show_save_and_continue': context.get('show_save_and_continue',
                                              ctx['show_save_and_continue']),
        'show_save': context.get('show_save',
                                 ctx['show_save']),
        'show_delete_link': context.get('show_delete_link', ctx['show_delete_link'])
    })
    return ctx
Esempio n. 18
0
def submit_row(context):
    """submit buttons context change"""
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another':
        context.get('show_save_and_add_another',
                    ctx['show_save_and_add_another']),
        'show_save_and_continue':
        context.get('show_save_and_continue', ctx['show_save_and_continue']),
        'show_save':
        context.get('show_save', ctx['show_save']),
    })
    return ctx
Esempio n. 19
0
def comments_submit_row(context):
    """
    Displays the row of buttons for delete and save.
    """
    if context.get("readonly"):
        return dict()
    ctx = original_submit_row(context)
    ctx.update({
        "show_save_and_add_another":
        (context.get("show_save_and_add_another", True)
         and context["has_add_permission"] and not context["is_popup"]
         and (not context["save_as"] or context["add"]))
    })
    return ctx
Esempio n. 20
0
def submit_row(context):
    print 'xxxctxxxxxxxxxxxxx'
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another':
        context.get('show_save_and_add_another',
                    ctx['show_save_and_add_another']),
        'show_save_and_continue':
        context.get('show_save_and_continue', ctx['show_save_and_continue']),
        'xxxx':
        'bbb',
    })
    print ctx
    return ctx
Esempio n. 21
0
def bhp_submit_row(context):
    try:
        ctx = original_submit_row(context)
    except KeyError:
        ctx = {'add': True}
    is_popup = context.get('is_popup', False)
    request = context.get('request', None)
    show = request.GET.get('show') == 'forms'
    ctx.update({
        #'show_save_and_add_another': context.get('show_save_and_add_another', ctx['show_save_and_add_another']),
        #'show_save_and_continue': context.get('show_save_and_continue', ctx['show_save_and_continue'])
        'show_savenext': (not is_popup and context.get('add') and show)
        })
    return ctx
def emailaddress_submit_row(context):
    ctx = original_submit_row(context)

    model_object = ctx.get('original')  # For add form model_object will be None

    ctx.update({
        # Do not show save and add another button
        'show_save_and_add_another': False,
        'show_save_as_new': False,

        'show_reject': model_object and model_object.admin_approval != 'rejected',
        'show_approve': model_object and model_object.admin_approval != 'approved',
    })

    return ctx
def custom_submit_row(context):
    ctx = original_submit_row(context)

    if 'show_save_and_add_another' in context:
        ctx.update({
            'show_save_and_add_another':
            context.get('show_save_and_add_another')
        })
    if 'show_hard_delete' in context:
        ctx.update({'show_hard_delete': context.get('show_hard_delete')})
    if 'show_recover' in context:
        ctx.update({'show_recover': context.get('show_recover')})
    if 'show_goback' in context:
        ctx.update({'show_goback': context.get('show_goback')})
    return ctx
Esempio n. 24
0
def submit_row(context):
    ctx = original_submit_row(context)
    ctx.update({
        'show_save_and_add_another':
        context.get('show_save_and_add_another',
                    ctx['show_save_and_add_another']),
        'show_save_and_continue':
        context.get('show_save_and_continue', ctx['show_save_and_continue']),
        'show_save':
        context.get('show_save', ctx['show_save']),
        'show_save_as_new':
        context.get('show_save_as_new', ctx['show_save_as_new']),
        'show_delete_link':
        context.get('show_save_and_add_another', ctx['show_delete_link']),
    })
    return ctx
    def submit_row(context):
        ctx = original_submit_row(context)
        app_name = context['app_label']
        model_name = context['opts'].model_name

        for permission in context['request'].user.get_all_permissions():
            head, sep, tail = permission.partition('.')
            perm = 'can_view_%s_only' % model_name
            if str(perm) == str(tail):
                if (context['request'].user.has_perm(str(permission)) and
                       not context['request'].user.is_superuser):
                    ctx.update({
                        'show_save_and_add_another' : False,
                        'show_save_and_continue'    : False,
                        'show_save'                 : False,
                        'show_save_as_new'          : False,
                        })
        return ctx
Esempio n. 26
0
    def submit_row(context):
        ctx = original_submit_row(context)
        app_name = context['app_label']
        model_name = context['opts'].model_name

        for permission in context['request'].user.get_all_permissions():
            head, sep, tail = permission.partition('.')
            perm = 'can_view_%s_only' % model_name
            if str(perm) == str(tail):
                if (context['request'].user.has_perm(str(permission))
                        and not context['request'].user.is_superuser):
                    ctx.update({
                        'show_save_and_add_another': False,
                        'show_save_and_continue': False,
                        'show_save': False,
                        'show_save_as_new': False,
                    })
        return ctx
Esempio n. 27
0
def submit_row(context):
    """
    Overrides 'django.contrib.admin.templatetags.admin_modify.submit_row'.

    Manipulates the context going into that function by hiding all of the buttons
    in the submit row if the key `readonly` is set in the context.
    """
    ctx = original_submit_row(context)

    if context.get('readonly', False):
        ctx.update({
            'show_delete_link': False,
            'show_save_as_new': False,
            'show_save_and_add_another': False,
            'show_save_and_continue': False,
            'show_save': False,
        })
    else:
        return ctx
Esempio n. 28
0
def submit_row(context):
    """
    Overrides 'django.contrib.admin.templatetags.admin_modify.submit_row'.

    Manipulates the context going into that function by hiding all of the buttons
    in the submit row if the key `readonly` is set in the context.
    """
    ctx = original_submit_row(context)

    if context.get('readonly', False):
        ctx.update({
            'show_delete_link': False,
            'show_save_as_new': False,
            'show_save_and_add_another': False,
            'show_save_and_continue': False,
            'show_save': False,
        })

    return ctx
    def submit_row(context):
        """Sumbit row.

        :param context: Dictionary of required data.
        :return: Return update context.
        """
        ctx = original_submit_row(context)
        app_name, seprator, model_name = str(context.dicts[0]['opts']).partition('.')

        for permission in context['request'].user.get_all_permissions():
            head, sep, tail = permission.partition('.')
            perm = "cannot_edit_record_for_%s" % (model_name)
            if str(perm) == str(tail):
                if context['request'].user.has_perm(str(permission)) and \
                        not context['request'].user.is_superuser:
                    ctx.update({
                        'show_save_and_add_another': False,
                        'show_save_and_continue': False,
                        'show_save': False,
                    })
                return ctx
        return ctx