Opened 9 months ago

Last modified 9 months ago

#35065 closed Bug

Django Admin doesn't render autocomplete field whith error color border properly. — at Initial Version

Reported by: Rigoberto Villalta Owned by: nobody
Component: contrib.admin Version: 4.2
Severity: Normal Keywords: Django 5.0, Django 4.2, Django Admin
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: yes

Description

In Django Admin, if the validations of an autocomplete fields fails, the border of the input field isn't´n of the error color (#ba2121 by default).

Why? Because in that case the select html element is hidden.

You can test it int this repo https://github.com/Rigo-Villalta/django-autocomplete-error-not-visible.

Solution: I think the best solution is to add to the end of the file /static/admin/css/autocomplete.css the following rule:

.errors .select2-selection {
    border: 1px solid var(--error-fg);
}

Someone could think that add the selector to the base.css file could works, but for inheritance doesn't work.

I will push the pull request in a minutes, but I am not sure if is the best solution.

Change History (1)

by Rigoberto Villalta, 9 months ago

Attachment: django-admin-sample.PNG added
Note: See TracTickets for help on using tickets.
Back to Top