Opened 8 years ago

Closed 8 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: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


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",)}

Change History (1)

comment:1 Changed 8 years ago by Russell Keith-Magee

Resolution: wontfix
Status: newclosed

Changing a field name like this would be a huge backwards incompatibility, and I'm not convinced that changing the name will add clarity.

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