#35273: AdminFileWidget renders two elements with the same ID
--------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 5.0
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+-------------------------------------
Changes (by Natalia Bidart):
* resolution: => needsinfo
* status: new => closed
Comment:
Thank you Johanness and Jörg!
Before accepting, we'd still need a sample project or test case showcasing
the issue, as I can't reproduce the duplicated ID symptom (I'm using
latest `main` though). I created a project of my own and defined a model
with a FileField, then configured its admin so the `AdminFileWidget` is
used. This is the resulting HTML which looks correct to me (at least it
does not have duplicated `id`s):
{{{
<p class="file-upload">Currently: <a
href="/images/test_X66RiS7.py">images/test_X66RiS7.py</a>
<span class="clearable-file-input">
<input type="checkbox" name="avatar-clear" id="avatar-clear_id">
<label for="avatar-clear_id">Clear</label></span><br>
Change:
<input type="file" name="avatar" id="id_avatar"></p>
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/35273#comment:6>