除了(有点尴尬)骇客风格之外,您还可以直接覆盖template标签。通常建议覆盖模板。
# put this in some app such as customize/templatetags/admin_modify.py and place the app# before the 'django.contrib.admin' in the INSTALLED_APPS in settingsfrom django.contrib.admin.templatetags.admin_modify import *from django.contrib.admin.templatetags.admin_modify import submit_row as original_submit_row# or # original_submit_row = submit_row@register.inclusion_tag('admin/submit_line.html', takes_context=True)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
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)