Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8544775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:38:29+00:00 2026-06-11T12:38:29+00:00

I would like to add an extra button to the submit row in django.

  • 0

I would like to add an extra button to the submit row in django.
Standard we get “delete”, “save”, “save and continue editing” and “save and add another”. To this set I would like to add another button which would call a function on the model.

As far as I understand the template change_form is generated in one of the admin.views. The context submit_row is passed as context.

I want to edit the context of the admin view. Where can I find it in my filesystem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:38:30+00:00Added an answer on June 11, 2026 at 12:38 pm

    From what I can tell, there are two relevant files. The first is

    .../django/contrib/admin/templatetags/admin_modify.py
    

    which has the following section:

    @register.inclusion_tag('admin/submit_line.html', takes_context=True)
    def submit_row(context):
        """
        Displays the row of buttons for delete and save.
        """
        opts = context['opts']
        change = context['change']
        is_popup = context['is_popup']
        save_as = context['save_as']
        return {
            'onclick_attrib': (opts.get_ordered_objects() and change
                                and 'onclick="submitOrderForm();"' or ''),
            'show_delete_link': (not is_popup and context['has_delete_permission']
                                  and (change or context['show_delete'])),
            'show_save_as_new': not is_popup and change and save_as,
            'show_save_and_add_another': context['has_add_permission'] and
                                not is_popup and (not save_as or context['add']),
            'show_save_and_continue': not is_popup and context['has_change_permission'],
            'is_popup': is_popup,
            'show_save': True
        }
    

    And the second is

    .../django/contrib/admin/templates/admin/submit_line.html
    

    which is the following:

    {% load i18n %}
    <div class="submit-row">
    {% if show_save %}<input type="submit" value="{% trans 'Save' %}" class="default" name="_save" {{ onclick_attrib }}/>{% endif %}
    {% if show_delete_link %}<p class="deletelink-box"><a href="delete/" class="deletelink">{% trans "Delete" %}</a></p>{% endif %}
    {% if show_save_as_new %}<input type="submit" value="{% trans 'Save as new' %}" name="_saveasnew" {{ onclick_attrib }}/>{%endif%}
    {% if show_save_and_add_another %}<input type="submit" value="{% trans 'Save and add another' %}" name="_addanother" {{ onclick_attrib }} />{% endif %}
    {% if show_save_and_continue %}<input type="submit" value="{% trans 'Save and continue editing' %}" name="_continue" {{ onclick_attrib }}/>{% endif %}
    </div>
    

    You can probably just add some custom html to the second file to display new buttons.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several very customized Django ModelAdmins that I would like to add extra
I would like to add some extra fields to pages in django-cms (in django
I'm plotting rose diagrams using Matlab7. And I would like to add an extra
I would like to add custom (non-project) files to generate some extra pages with
I've created a jQuery UI button, and would like to add a 'X' secondary
Using python's optparse module I would like to add extra example lines below the
I would like to add the mugshot in django userena to the initial registration
I have an NSString that I would like to add extra characters to. In
I have own project and i would like add for this class same as
I have a ListView and each item have a TextView. I would like add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.