[Django] #35065: Django Admin doesn't render autocomplete field whith error color border properly.

6 views
Skip to first unread message

Django

unread,
Dec 27, 2023, 5:20:04 PM12/27/23
to django-...@googlegroups.com
#35065: Django Admin doesn't render autocomplete field whith error color border
properly.
-------------------------------------+-------------------------------------
Reporter: Rigoberto | Owner: nobody
Villalta |
Type: Bug | Status: new
Component: | Version: 4.2
contrib.admin | Keywords: Django 5.0, Django
Severity: Normal | 4.2, Django Admin
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 1 |
-------------------------------------+-------------------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/35065>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 27, 2023, 5:20:24 PM12/27/23
to django-...@googlegroups.com
#35065: Django Admin doesn't render autocomplete field whith error color border
properly.
-------------------------------------+-------------------------------------
Reporter: Rigoberto Villalta | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: Django 5.0, Django | Triage Stage:
4.2, Django Admin | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Rigoberto Villalta):

* Attachment "django-admin-sample.PNG" added.

Django

unread,
Dec 27, 2023, 5:23:32 PM12/27/23
to django-...@googlegroups.com
#35065: Django Admin doesn't render autocomplete field whith error color border
properly.
-------------------------------------+-------------------------------------
Reporter: Rigoberto Villalta | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: Django 5.0, Django | Triage Stage:
4.2, Django Admin | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Description changed by Rigoberto Villalta:

Old 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.

New 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).

[[Image(ticket:35065:django-admin-sample.PNG)]]

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.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/35065#comment:1>

Django

unread,
Dec 28, 2023, 12:08:29 AM12/28/23
to django-...@googlegroups.com
#35065: Django Admin doesn't render autocomplete field whith error color border
properly.
-------------------------------------+-------------------------------------
Reporter: Rigoberto Villalta | Owner: Rigoberto
| Villalta
Type: Bug | Status: assigned

Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: Django 5.0, Django | Triage Stage: Accepted
4.2, Django Admin |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => Rigoberto Villalta
* status: new => assigned
* has_patch: 1 => 0
* easy: 0 => 1
* stage: Unreviewed => Accepted


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/35065#comment:2>

Reply all
Reply to author
Forward
0 new messages