Opened 4 weeks ago

Closed 4 weeks ago

Last modified 4 weeks ago

#36659 closed Bug (fixed)

Re-enable custom height for flatpage content field in admin

Reported by: Baptiste Mispelon Owned by: Baptiste Mispelon
Component: contrib.flatpages Version: 5.2
Severity: Normal Keywords:
Cc: Antoliny Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The admin's forms.css file contains this rule [1]:

.flatpages-flatpage #id_content {
    height: 40.2em;
}

The purpose of this rule (I'm guessing) is to make the FlatPage.content field taller on the add/change form, because this field typically contains a lot of text. This appears to be basically as old as the admin itself, and was added in dd5320d1d56ca7603747dd68871e72eee99d9e67 (where it started as body.core-flatfile #id_content { height: 400px; }).

However this rule doesn't currently do anything, because the .flatpages-flatpage selector doesn't match anything.

This appears to be a regression that was introduced in release 1.6 with commit bb145e2c47d71b7f68280c00ced727442d2effa2 wich effectively changed the body class from flatpages-flatpage to app-flatpages model-flatpage.

[1] https://github.com/django/django/blob/1167cd1d639c3fee69dbdef351d31e8a17d1fedf/django/contrib/admin/static/admin/css/forms.css#L360-L362

Attachments (1)

ticket-36659.diff (630 bytes ) - added by Baptiste Mispelon 4 weeks ago.

Download all attachments as: .zip

Change History (13)

by Baptiste Mispelon, 4 weeks ago

Attachment: ticket-36659.diff added

comment:1 by Antoliny, 4 weeks ago

Triage Stage: UnreviewedAccepted

Thank you Baptiste!
As you mentioned, it seems that the #id_content was intended to make the Content field larger on the FlatPage model Change/Add form.
However, I wasn’t able to find any part of the admin where this CSS is actually being applied.
And thank you for adding detailed information to the ticket, it really helped me understand and verify the issue!

comment:2 by Antoliny, 4 weeks ago

Cc: Antoliny added

comment:3 by Khanh Vy Nguyen, 4 weeks ago

Owner: set to Khanh Vy Nguyen
Status: newassigned

I will take this task as my first contribution to the django project.

in reply to:  3 ; comment:4 by Baptiste Mispelon, 4 weeks ago

Replying to Khanh Vy Nguyen:

I will take this task as my first contribution to the django project.

Hi 👋🏻,
Thank you for your interest, but this ticket already has a patch attached (see the "Has patch" field).

in reply to:  4 ; comment:5 by Antoliny, 4 weeks ago

Replying to Baptiste Mispelon:

Hi 👋🏻,
Thank you for your interest, but this ticket already has a patch attached (see the "Has patch" field).

Hello Baptiste, do you happen to know where this PR is? I couldn’t find it anywhere...

in reply to:  5 comment:6 by Baptiste Mispelon, 4 weeks ago

Replying to Antoliny:

Hello Baptiste, do you happen to know where this PR is? I couldn’t find it anywhere...

It's not a PR, it's attached as a patch to this ticket (see "Attachments" at the top)

comment:7 by Jacob Walls, 4 weeks ago

Owner: changed from Khanh Vy Nguyen to Baptiste Mispelon

Thanks, a PR would be helpful at this point.

in reply to:  7 comment:8 by Baptiste Mispelon, 4 weeks ago

Replying to Jacob Walls:

Thanks, a PR would be helpful at this point.

Sure thing, here you go: https://github.com/django/django/pull/19958

comment:9 by Jacob Walls, 4 weeks ago

Triage Stage: AcceptedReady for checkin

Tangent: seems a bit odd to be doing this with CSS instead in flatpages/admin.py via the rows attribute on the <TextArea>, but happy to merge this (well spotted!)

Version 0, edited 4 weeks ago by Jacob Walls (next)

comment:10 by Jacob Walls, 4 weeks ago

Component: contrib.admincontrib.flatpages

comment:11 by Jacob Walls <jacobtylerwalls@…>, 4 weeks ago

Resolution: fixed
Status: assignedclosed

In 2b62951f:

Fixed #36659 -- Fixed flatpage content selector in admin forms.css.

Regression in bb145e2c47d71b7f68280c00ced727442d2effa2.

comment:12 by Jacob Walls <jacobtylerwalls@…>, 4 weeks ago

In 094797a:

[6.0.x] Fixed #36659 -- Fixed flatpage content selector in admin forms.css.

Regression in bb145e2c47d71b7f68280c00ced727442d2effa2.

Backport of 2b62951fecf0024ce9ce0ce9f5be512c10747c0d from main.

Note: See TracTickets for help on using tickets.
Back to Top