
import admin_advanced  # Don't delete
import admin_basic  # Don't delete

from django.contrib.admin.templatetags.admin_modify import register
from django.contrib.admin.templatetags.admin_modify import submit_row as osr


# If the developer wants to enable/disable the save buttons,
# we want to give preference over Django's logic
# https://github.com/django/django/blob/master/django/contrib/admin/templatetags/admin_modify.py#L23
@register.inclusion_tag('admin/submit_line.html', takes_context=True)
def submit_row(context):
    ctx = osr(context)  # Here is Django's logic => it ignores the context
    if 'show_save_and_continue' in context:
        ctx['show_save_and_continue'] = context['show_save_and_continue']
    if 'show_save' in context:
        ctx['show_save'] = context['show_save']
    return ctx

import admin_advanced  # Don't delete
import admin_basic  # Don't delete

Patch django submit_row templatetag so it takes into account button config sent in context
Patch django submit_row templatetag so it takes into account button config sent in context

+ from django.contrib.admin.templatetags.admin_modify import register
+ from django.contrib.admin.templatetags.admin_modify import submit_row as osr
+ 
+ 
+ # If the developer wants to enable/disable the save buttons,
+ # we want to give preference over Django's logic
+ # https://github.com/django/django/blob/master/django/contrib/admin/templatetags/admin_modify.py#L23
+ @register.inclusion_tag('admin/submit_line.html', takes_context=True)
+ def submit_row(context):
+     ctx = osr(context)  # Here is Django's logic => it ignores the context
+     if 'show_save_and_continue' in context:
+         ctx['show_save_and_continue'] = context['show_save_and_continue']
+     if 'show_save' in context:
+         ctx['show_save'] = context['show_save']
+     return ctx
  
  import admin_advanced  # Don't delete
  import admin_basic  # Don't delete
  
Patch django submit_row templatetag so it takes into account button config sent in context
## Code Before:

import admin_advanced  # Don't delete
import admin_basic  # Don't delete

## Instruction:
Patch django submit_row templatetag so it takes into account button config sent in context
## Code After:
from django.contrib.admin.templatetags.admin_modify import register
from django.contrib.admin.templatetags.admin_modify import submit_row as osr


# If the developer wants to enable/disable the save buttons,
# we want to give preference over Django's logic
# https://github.com/django/django/blob/master/django/contrib/admin/templatetags/admin_modify.py#L23
@register.inclusion_tag('admin/submit_line.html', takes_context=True)
def submit_row(context):
    ctx = osr(context)  # Here is Django's logic => it ignores the context
    if 'show_save_and_continue' in context:
        ctx['show_save_and_continue'] = context['show_save_and_continue']
    if 'show_save' in context:
        ctx['show_save'] = context['show_save']
    return ctx

import admin_advanced  # Don't delete
import admin_basic  # Don't delete
