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)
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
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
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
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
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
def submit_row(context): ''' 删除"保存后添加"按钮 ''' ctx = original_submit_row(context) ctx.update({ 'show_save_and_add_another': False, }) return ctx
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
def submit_row(context): """ Delete "Save Add" button """ ctx = original_submit_row(context) ctx.update({ 'show_save_and_add_another': False, }) return ctx
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
def submit_row(context): """ 删除"保存后添加"按钮 """ ctx = original_submit_row(context) ctx.update({ 'show_save_and_add_another': False, }) return ctx
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
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
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
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
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
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
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
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
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
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
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
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
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