# Editable BooleanField on Admin List View - CSS Issue

**URL:** <https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306>\
**Category:** The Admin\
**Created:** [June 2, 2023, 10:28am UTC](https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306 "2023-06-02T10:28:46Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![psyonara](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/psyonara/32/993_2.png) [@psyonara](https://forum.djangoproject.com/u/psyonara)\
**Post date:** [June 2, 2023, 10:28am UTC](https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306/1 "2023-06-02T10:28:46Z")

</div>

Hello! 🙂

In Django Admin, if you specify a BooleanField in `list_display`, Admin shows it as a tick mark or cross. Now if you make that field editable (by adding it to `list_editable`), it changes it to a checkbox, and adds a Save button at the bottom.

That’s all good, but the issue is CSS-related (I think). For each of those checkboxes that is selected, it sees that row in the list as selected, and will change the background colour. Toggling the checkbox on and off toggles the background colour. This is the behaviour that would be expected from the first checkbox in each row, which is meant to be used for actions. Any other checkboxes in the list shouldn’t trigger the row to be selected.

I’m not sure where exactly the root of this issue lies, or if it’s even something that Django can fix. But just thought I’d mention it, to see if anyone has any ideas.

Thank you!

---

<div class="post-metadata">

**Author:** ![Rigo-Villalta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rigo-villalta/32/5667_2.png) [@Rigo-Villalta](https://forum.djangoproject.com/u/Rigo-Villalta)\
**Post date:** [June 2, 2023, 5:01pm UTC](https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306/2 "2023-06-02T17:01:25Z")

</div>

Can you comment what version of Django - Python are you using? Do you have some package that works in the Admin Site?

---

<div class="post-metadata">

**Author:** ![psyonara](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/psyonara/32/993_2.png) [@psyonara](https://forum.djangoproject.com/u/psyonara)\
**Post date:** [June 2, 2023, 5:42pm UTC](https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306/3 "2023-06-02T17:42:55Z")

</div>

Apologies! This is Django 4.2 on Python 3.11. 🙂 Not using any other packages that integrate with the admin.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [June 2, 2023, 6:14pm UTC](https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306/4 "2023-06-02T18:14:09Z")

</div>

This appears to be a result of the fix for [#33491](https://code.djangoproject.com/ticket/33491) which added the following to the [`changelists.css`](https://github.com/django/django/blob/27fed08e5ff597c813de25b6e89dc300a1f4231b/django/contrib/admin/static/admin/css/changelists.css#LL264C1-L267C1) file:

```auto
#changelist table tbody tr:has(input[type=checkbox]:checked) {
    background-color: var(--selected-row);
}

```

I’m far from being a CSS expert, but it appears to me that this will set the background color for any selected checkbox in the row.

I don’t know if its possible to construct a selector so that it only applies to the first element (or first checkbox) - or even if that would be the correct solution.

---

<div class="post-metadata">

**Author:** ![Rigo-Villalta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rigo-villalta/32/5667_2.png) [@Rigo-Villalta](https://forum.djangoproject.com/u/Rigo-Villalta)\
**Post date:** [June 2, 2023, 6:36pm UTC](https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306/5 "2023-06-02T18:36:50Z")

</div>

I think this should work:

#changelist table tbody tr:first-child input[type=checkbox]:checked {  
background-color: var(–selected-row);  
}

I will tested and made a PR

---

<div class="post-metadata">

**Author:** ![Rigo-Villalta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rigo-villalta/32/5667_2.png) [@Rigo-Villalta](https://forum.djangoproject.com/u/Rigo-Villalta)\
**Post date:** [June 2, 2023, 10:23pm UTC](https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306/6 "2023-06-02T22:23:38Z")

</div>

Making some manual tests I think the problem is with the chromium engine. Sadly I haven´t a webkit Browser since I use WSL. I will make other tests and report the progress in this space.

---

<div class="post-metadata">

**Author:** ![Rigo-Villalta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rigo-villalta/32/5667_2.png) [@Rigo-Villalta](https://forum.djangoproject.com/u/Rigo-Villalta)\
**Post date:** [July 7, 2023, 3:08pm UTC](https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306/7 "2023-07-07T15:08:01Z")

</div>

Hi everyone,

I’m writing this in case someone else is having the same problem. After some testing, I’m confident that the problem is with the browser cache. If you’re developing with multiple Django versions (in my case, 3.1, 3.2, 4.0, and 4.2), the browser cache can use older versions of CSS files, which can cause problems.

One specific problem that I encountered was with the delete button in the `change_view` of a `ModelAdmin`. The button was being displayed as a block element, and it was taking up the entire container in a new row.

To fix this problem, I cleared the browser cache and restarted the development server. This forced the browser to load the latest versions of the CSS files, and the problem was resolved. I think it could be a good “first general solution” in case of problems with css and Dajngo Admin.

I hope this helps!

---

<div class="post-metadata">

**Author:** ![psyonara](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/psyonara/32/993_2.png) [@psyonara](https://forum.djangoproject.com/u/psyonara)\
**Post date:** [July 12, 2023, 12:50pm UTC](https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306/8 "2023-07-12T12:50:58Z")

</div>

I have tested this and am convinced that it is not due to caching. Clearing the cache, restarting the server, etc, did not resolve the problem.  
Yes, there are other problems with the CSS that I did also encounter while switching Django versions, but the one with the row selection remains no matter what I try.

---

<div class="post-metadata">

**Author:** ![Rigo-Villalta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rigo-villalta/32/5667_2.png) [@Rigo-Villalta](https://forum.djangoproject.com/u/Rigo-Villalta)\
**Post date:** [July 12, 2023, 4:52pm UTC](https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306/9 "2023-07-12T16:52:51Z")

</div>

I will test again, because this exactly problem was solving in my dev environment. Could you share your exact environment (OS, Web Browser).

Have you try with other browsers? Have you try in LAN? Production?

---

<div class="post-metadata">

**Author:** ![psyonara](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/psyonara/32/993_2.png) [@psyonara](https://forum.djangoproject.com/u/psyonara)\
**Post date:** [July 21, 2023, 12:19pm UTC](https://forum.djangoproject.com/t/editable-booleanfield-on-admin-list-view-css-issue/21306/10 "2023-07-21T12:19:43Z")

</div>

This has been fixed in 4.2.3, I see now.

> **[Django](https://docs.djangoproject.com/en/4.2/releases/4.2.3/)**
>
> The web framework for perfectionists with deadlines.

Second item under bugfixes. 🙂
