Skip to content

Commit 35dab0a

Browse files
Fixed #36887 -- Improved admin changelist layout for object-tools button.
1 parent a328c35 commit 35dab0a

15 files changed

Lines changed: 38 additions & 27 deletions

File tree

django/contrib/admin/static/admin/css/base.css

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -808,18 +808,25 @@ a.deletelink:focus, a.deletelink:hover {
808808
text-decoration: none;
809809
}
810810

811+
/* TITLES */
812+
813+
.titles-and-tools {
814+
display: flex;
815+
}
816+
817+
.titles {
818+
flex-grow: 1;
819+
}
820+
811821
/* OBJECT TOOLS */
812822

813823
.object-tools {
814824
padding: 0;
815-
overflow: hidden;
816-
text-align: right;
817-
margin: 0 0 15px;
825+
margin: 0;
818826
}
819827

820828
.object-tools li {
821829
display: inline-block;
822-
height: auto;
823830
}
824831

825832
.object-tools li + li {

django/contrib/admin/static/admin/css/responsive.css

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,15 @@ input[type="submit"], button {
439439
margin-top: 30px;
440440
}
441441

442-
.object-tools {
443-
text-align: left;
442+
/* Forms */
443+
444+
.titles-and-tools {
445+
flex-direction: column;
444446
}
445447

446-
/* Forms */
448+
.object-tools {
449+
margin-bottom: 10px;
450+
}
447451

448452
.form-row {
449453
padding: 15px 0;

django/contrib/admin/static/admin/css/responsive_rtl.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@
5353
margin-right: 0;
5454
}
5555

56-
[dir="rtl"] .object-tools {
57-
text-align: right;
58-
}
59-
6056
[dir="rtl"] .aligned .vCheckboxLabel {
6157
padding: 1px 5px 0 0;
6258
}

django/contrib/admin/static/admin/css/rtl.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ th {
2525
background-position: 100% 1px;
2626
}
2727

28-
.object-tools {
29-
text-align: left;
30-
}
31-
3228
.object-tools li + li {
3329
margin-right: 15px;
3430
margin-left: 0;

django/contrib/admin/templates/admin/base.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,15 @@
9898
{% endblock messages %}
9999
<!-- Content -->
100100
<div id="content" class="{% block coltype %}colM{% endblock %}">
101-
{% block pretitle %}{% endblock %}
102-
{% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
103-
{% block content_subtitle %}{% if subtitle %}<h2>{{ subtitle }}</h2>{% endif %}{% endblock %}
104-
{% block content %}
101+
<div class="titles-and-tools">
102+
<div class="titles">
103+
{% block pretitle %}{% endblock %}
104+
{% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
105+
{% block content_subtitle %}{% if subtitle %}<h2>{{ subtitle }}</h2>{% endif %}{% endblock %}
106+
</div>
105107
{% block object-tools %}{% endblock %}
108+
</div>
109+
{% block content %}
106110
{{ content }}
107111
{% endblock %}
108112
{% block sidebar %}{% endblock %}

django/contrib/admin/templates/admin/change_form.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
{% endblock %}
2525
{% endif %}
2626

27-
{% block content %}<div id="content-main">
2827
{% block object-tools %}
2928
{% if change and not is_popup %}
3029
<ul class="object-tools">
@@ -34,6 +33,8 @@
3433
</ul>
3534
{% endif %}
3635
{% endblock %}
36+
37+
{% block content %}<div id="content-main">
3738
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}{% if form_url %}action="{{ form_url }}" {% endif %}method="post" id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %}
3839
<div>
3940
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1">{% endif %}

django/contrib/admin/templates/admin/change_list.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,16 @@
3939

4040
{% block coltype %}{% endblock %}
4141

42+
{% block object-tools %}
43+
<ul class="object-tools">
44+
{% block object-tools-items %}
45+
{% change_list_object_tools %}
46+
{% endblock %}
47+
</ul>
48+
{% endblock %}
49+
4250
{% block content %}
4351
<div id="content-main">
44-
{% block object-tools %}
45-
<ul class="object-tools">
46-
{% block object-tools-items %}
47-
{% change_list_object_tools %}
48-
{% endblock %}
49-
</ul>
50-
{% endblock %}
5152
{% if cl.formset and cl.formset.errors %}
5253
<p class="errornote">
5354
{% blocktranslate count counter=cl.formset.total_error_count %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktranslate %}

docs/intro/_images/admin04t.png

7.08 KB
Loading

docs/intro/_images/admin05t.png

-402 Bytes
Loading

docs/intro/_images/admin07t.png

17.1 KB
Loading

0 commit comments

Comments
 (0)