Opened 5 months ago

Closed 5 months 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 Rigoberto Villalta)

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)

django-admin-sample.PNG (12.9 KB ) - added by Rigoberto Villalta 5 months ago.

Download all attachments as: .zip

Change History (7)

by Rigoberto Villalta, 5 months ago

Attachment: django-admin-sample.PNG added

comment:1 by Rigoberto Villalta, 5 months ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 5 months ago

Easy pickings: set
Has patch: unset
Owner: changed from nobody to Rigoberto Villalta
Status: newassigned
Triage Stage: UnreviewedAccepted

Thanks for the report, please submit patch via GitHub PR.

comment:3 by Mariusz Felisiak, 5 months ago

Summary: Django Admin doesn't render autocomplete field whith error color border properly.Autocomplete field is not rendered with error color border.

comment:4 by Mariusz Felisiak, 5 months ago

Has patch: set

comment:5 by Mariusz Felisiak, 5 months ago

Triage Stage: AcceptedReady for checkin

comment:6 by GitHub <noreply@…>, 5 months ago

Resolution: fixed
Status: assignedclosed

In 63076e36:

Fixed #35065 -- Corrected border color for autocomplete fields with errors in admin.

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