1
0
mirror of https://github.com/django/django.git synced 2025-03-06 07:22:32 +00:00

[5.2.x] Fixed #36055 -- Prevented overlap of object-tools buttons and page header in the admin.

Backport of b1324a680add78de24c763911d0eefa19b9263bc from main.
This commit is contained in:
antoliny0919 2025-01-12 19:22:15 +09:00 committed by Sarah Boyce
parent 303c2569da
commit d03102a5a8
5 changed files with 34 additions and 10 deletions

View File

@ -773,7 +773,6 @@ a.deletelink:focus, a.deletelink:hover {
padding-left: 0;
float: right;
position: relative;
margin-top: -48px;
}
.object-tools li {
@ -821,6 +820,10 @@ a.deletelink:focus, a.deletelink:hover {
background-image: url(../img/tooltag-add.svg);
}
.object-tools:has(a.addlink) {
margin-top: -48px;
}
/* OBJECT HISTORY */
#change-history table {

View File

@ -98,9 +98,9 @@
<div id="content" class="{% block coltype %}colM{% endblock %}">
{% block pretitle %}{% endblock %}
{% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
{% block object-tools %}{% endblock %}
{% block content_subtitle %}{% if subtitle %}<h2>{{ subtitle }}</h2>{% endif %}{% endblock %}
{% block content %}
{% block object-tools %}{% endblock %}
{{ content }}
{% endblock %}
{% block sidebar %}{% endblock %}

View File

@ -24,7 +24,6 @@
{% endblock %}
{% endif %}
{% block content %}<div id="content-main">
{% block object-tools %}
{% if change and not is_popup %}
<ul class="object-tools">
@ -34,6 +33,8 @@
</ul>
{% endif %}
{% endblock %}
{% block content %}<div id="content-main">
<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 %}
<div>
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1">{% endif %}

View File

@ -39,15 +39,16 @@
{% block coltype %}{% endblock %}
{% block object-tools %}
<ul class="object-tools">
{% block object-tools-items %}
{% change_list_object_tools %}
{% endblock %}
</ul>
{% endblock %}
{% block content %}
<div id="content-main">
{% block object-tools %}
<ul class="object-tools">
{% block object-tools-items %}
{% change_list_object_tools %}
{% endblock %}
</ul>
{% endblock %}
{% if cl.formset and cl.formset.errors %}
<p class="errornote">
{% blocktranslate count counter=cl.formset.total_error_count %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktranslate %}

View File

@ -127,6 +127,7 @@ from .models import (
Song,
State,
Story,
Subscriber,
SuperSecretHideout,
SuperVillain,
Telegram,
@ -6861,6 +6862,24 @@ class SeleniumTests(AdminSeleniumTestCase):
name_input_value = name_input.get_attribute("value")
self.assertEqual(name_input_value, "Test section 1")
@screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"])
def test_long_object_str_on_change_view(self):
from selenium.webdriver.common.by import By
self.admin_login(
username="super", password="secret", login_url=reverse("admin:index")
)
s = Subscriber.objects.create(name="a " * 40, email="b " * 80)
self.selenium.get(
self.live_server_url
+ reverse("admin:admin_views_subscriber_change", args=(s.pk,))
)
object_tools = self.selenium.find_elements(
By.CSS_SELECTOR, "div#content ul.object-tools li"
)
self.assertGreater(len(object_tools), 0)
self.take_screenshot("not-overwrap")
@override_settings(ROOT_URLCONF="admin_views.urls")
class ReadonlyTest(AdminFieldExtractionMixin, TestCase):