summaryrefslogtreecommitdiff
path: root/lib/grappelli/templates/admin/change_form.html
blob: 620b16661ea3f5d48a3768d5c914331e708789a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{% extends "admin/base_site.html" %}

<!-- LOADING -->
{% load i18n admin_modify adminmedia grp_tags %}

<!-- JAVASCRIPTS -->
{% block javascripts %}
    {{ block.super }}
    {% url admin:jsi18n as jsi18nurl %}
    <script type="text/javascript" src="{{ jsi18nurl|default:"../../../jsi18n/" }}"></script>
    {{ media }}
{% endblock %}

<!-- COLTYPE/BODYCLASS -->
{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}
{% block content-class %}content-flexible{% endblock %}

<!-- BREADCRUMBS -->
{% block breadcrumbs %}
    {% if not is_popup %}
        <div id="breadcrumbs">
             <a href="../../../">{% trans "Home" %}</a> &rsaquo;
             <a href="../../">{% trans app_label|capfirst|escape %}</a> &rsaquo;
             {% if has_change_permission %}<a href="../">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} &rsaquo; 
             {% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %}
        </div>
    {% endif %}
{% endblock %}

<!-- OBJECT TOOLS -->
{% block object-tools %}
    {% if change %}
        {% if not is_popup %}
            <ul class="tools">
                <li><a href="history/">{% trans "History" %}</a></li>
                {% if has_absolute_url %}<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="focus" target="_blank">{% trans "View on site" %}</a></li>{% endif%}
            </ul>
        {% endif %}
    {% endif %}
{% endblock %}

<!-- CONTENT -->
{% block content %}
    <div class="container-flexible">
        <div class="form-container">
            <form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form">{% csrf_token %}{% block form_top %}{% endblock %} 
                <div>
                    <!-- Popup Hidden Field -->
                    {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
                    
                    <!-- Submit-Row -->
                    {% if save_on_top %}{% submit_row %}{% endif %}
                    
                    <!-- Errors -->
                    {% if errors %}
                        <p class="errornote">{% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}</p>
                        <ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul>
                    {% endif %}
                    
                    <!-- Fieldsets -->
                    {% for fieldset in adminform %}
                        {% include "admin/includes/fieldset.html" %}
                    {% endfor %}
                    
                    {% block after_field_sets %}{% endblock %}
                    
                    <!-- Inlines -->
                    {% for inline_admin_formset in inline_admin_formsets %}
                        {% include inline_admin_formset.opts.template %}
                    {% endfor %}
                    
                    {% block after_related_objects %}{% endblock %}
                    
                    <!-- Submit-Row -->
                    {% submit_row %}
                    
                    {% if adminform and add %}
                        {% block extrahead %}
                            <script type="text/javascript">
                                (function($){
                                    $(function(){
                                        try {
                                            {# Focus on first FormField #}
                                            $("#{{ adminform.first_field.auto_id }}, #{{ adminform.first_field.auto_id }}_0")
                                            .eq(0).focus();
                                        } catch(e) {}
                                    });
                                }(django.jQuery));
                            </script>
                        {% endblock %}
                    {% endif %}
                    
                    <!-- JS for prepopulated fields -->
                    {% prepopulated_fields_js %}
                    
                </div>
            </form>
        </div>
    </div>
{% endblock %}