Opened 3 years ago

Closed 3 years ago

#33283 closed New feature (wontfix)

Support for map function on ModelAdmin.prepopulated_fields.

Reported by: Richard Connon Owned by: nobody
Component: contrib.admin Version: 4.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (1)

comment:1 by Mariusz Felisiak, 3 years ago

Resolution: wontfix
Status: newclosed
Summary: Support for map function on `ModelAdmin.prepopulated_fields`Support for map function on ModelAdmin.prepopulated_fields.

Thanks for this ticket, however it's quite niche and the Django Admin is not an 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.

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