Adding buttons to submit line in a Admin page

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{% extends "admin/change_form.html" %}
{% load i18n %}

{% block extrahead %}{{ block.super }}

<script src="/media/js/jquery.js"></script>
<script>
    $(document).ready(function() {
        $('.move_to_submit_row').insertBefore('.submit-row>input:first');
    });
</script>
{% endblock extrahead %}

{% block after_field_sets %}{{ block.super }}

<input value="{% trans "Profile" %}"
 onclick="javascript: window.location='/admin/central/userprofile/{{ original.get_profile.id }}/'"
 class="move_to_submit_row" type="button"/>
{% endblock after_field_sets %}

More like this

  1. Confirm alert if the user navigates away without saving changes by mrazzari 4 years, 9 months ago
  2. Admin actions as buttons instead of a menu by andybak 4 years, 2 months ago
  3. Dynamically add inlines by MasonM 4 years, 10 months ago
  4. Collapsed stacked inlines by Aneon 4 years, 11 months ago
  5. Admin Input Field Character Count via jQuery by joshman 5 years, 4 months ago

Comments

itavor (on May 14, 2008):

Nice! I already include jQuery in admin for most of my sites and use it to do other customizations, this is very easy to add and very useful.

#

(Forgotten your password?)