Opened 15 years ago
Closed 15 years ago
#13386 closed (wontfix)
Change name of ```ModelAdmin.prepopulated_fields``` to ```prepopulated_slug_fields``` to better reflect the actual purpose
Reported by: | Remco Wendt | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | 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
The ModelAdmin.prepopulated_fields
documentation now states:
When set, the given fields will use a bit of JavaScript to populate from the fields assigned. The main use for this functionality is to automatically generate the value for SlugField fields from one or more other fields. The generated value is produced by concatenating the values of the source fields, and then by transforming that result into a valid slug (e.g. substituting dashes for spaces).
This option is not a solution for using javascript in general to prepopulate fields in the admin, but is specifically designed for use with SlugField
and autopopulating this type of field. Because of this specific use I propose to rename the option in a future version of Django to better clarify the intended use of this option. A more logical naming would be:
prepopulated_slug_fields
So instead of:
class ArticleAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("title",)}
One would use:
class ArticleAdmin(admin.ModelAdmin): prepopulated_slug_fields = {"slug": ("title",)}
Note:
See TracTickets
for help on using tickets.
Changing a field name like this would be a huge backwards incompatibility, and I'm not convinced that changing the name will add clarity.