Opened 2 years ago
Closed 2 years ago
#35065 closed Bug (fixed)
Autocomplete field is not rendered with error color border.
| Reported by: | Rigoberto Villalta | Owned by: | Rigoberto Villalta |
|---|---|---|---|
| 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 (last modified by )
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.
Attachments (1)
Change History (7)
by , 2 years ago
| Attachment: | django-admin-sample.PNG added |
|---|
comment:1 by , 2 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 2 years ago
| Easy pickings: | set |
|---|---|
| Has patch: | unset |
| Owner: | changed from to |
| Status: | new → assigned |
| Triage Stage: | Unreviewed → Accepted |
comment:3 by , 2 years ago
| Summary: | Django Admin doesn't render autocomplete field whith error color border properly. → Autocomplete field is not rendered with error color border. |
|---|
comment:5 by , 2 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Thanks for the report, please submit patch via GitHub PR.