[Django] #33283: Support for map function on `ModelAdmin.prepopulated_fields`

9 views
Skip to first unread message

Django

unread,
Nov 12, 2021, 9:34:57 AM11/12/21
to django-...@googlegroups.com
#33283: Support for map function on `ModelAdmin.prepopulated_fields`
-----------------------------------------+------------------------
Reporter: riconnon | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
When using `ModelAdmin.prepopulated_fields` to populate a field based on
entry into another field it would be very useful to be able to supply a
map function which modifies the value before pre-population.

My particular use-case, is to pre-populate a field using the filename of
the file being uploaded to a `FileField`, which using the current option
ends up including something like "cfakepath" as a prefix.

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

Django

unread,
Nov 13, 2021, 1:09:40 PM11/13/21
to django-...@googlegroups.com
#33283: Support for map function on ModelAdmin.prepopulated_fields.
--------------------------------+--------------------------------------
Reporter: Richard Connon | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => wontfix


Comment:

Thanks for this ticket, however it's quite niche and the Django Admin is
not an [https://docs.djangoproject.com/en/3.2/ref/contrib/admin/#module-
django.contrib.admin universal tool for building an app]. You can always
add a custom JS to handle this in your own project.

Feel-free to start a discussion on DevelopersMailingList if you don't
agree, but I don't think there would be consensus to add that complexity.

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

Reply all
Reply to author
Forward
0 new messages