Changes between Version 19 and Version 20 of NewformsAdminBranch
- Timestamp:
- Apr 9, 2007, 3:09:14 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
NewformsAdminBranch
v19 v20 153 153 === Changed prepopulate_from to be defined in the Admin class, not database field classes === 154 154 155 As of [4446], the {{{prepopulate_from}}} option to database fields no longer exists. It's been discontinued in favor of the new {{{prepopulated_fields}}} option on {{{class Admin}}}. The new {{{prepopulated_fields}}} option, if given, should be a dictionary mapping field names to lists/tuples of field names. Here's an example comparing old syntax and new syntax:155 As of [4446], the {{{prepopulate_from}}} option to database fields no longer exists. It's been discontinued in favor of the new {{{prepopulated_fields}}} option on {{{class Admin}}}. The new {{{prepopulated_fields}}} option, if given, should be a dictionary mapping field names to lists/tuples of field names. This change was made to separate the content of models with the presentation of admin : models represent structures of tables, and shouldn't be spoilt by admin stuff. Here's an example comparing old syntax and new syntax: 156 156 157 157 {{{ … … 173 173 slug = models.CharField(maxlength=60) 174 174 175 class Admin: 176 prepopulated_fields = {'slug': ('first_name', 'last_name')} 175 from django.contrib import admin 176 177 class MyModelOptions(admin.ModelAdmin): 178 prepopulated_fields = {'slug': ('first_name', 'last_name')} 179 180 admin.site.register(MyModel, MyModelOptions) 177 181 }}} 178 182