Code

Changes between Version 72 and Version 73 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
01/28/07 17:11:58 (7 years ago)
Author:
adrian
Comment:

Added "Changed prepopulate_from to be defined in the Admin class, not database field classes"

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v72 v73  
    4040 * September 27, 2006: [http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#RemovedENABLE_PSYCOsetting Removed ENABLE_PSYCO setting] 
    4141 * January 16, 2007: [http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#ChangedAdmin.manageroptiontomoreflexiblehook Changed Admin.manager option to more flexible hook] 
     42 * January 28, 2007: [http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Changedprepopulate_fromtobedefinedintheAdminclassnotdatabasefieldclasses Changed prepopulate_from to be defined in the Admin class, not database field classes] 
    4243 
    4344== Moved mod_python handler == 
     
    610611 
    611612Note that this change was made to the NewformsAdminBranch branch, which is scheduled to merge to trunk by January 31. The change will not be made to trunk until that branch is merged to trunk. 
     613 
     614== Changed prepopulate_from to be defined in the Admin class, not database field classes == 
     615 
     616As 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: 
     617 
     618{{{ 
     619#!python 
     620 
     621# OLD: 
     622class MyModel(models.Model): 
     623    first_name = models.CharField(maxlength=30) 
     624    last_name = models.CharField(maxlength=30) 
     625    slug = models.CharField(maxlength=60, prepopulate_from=('first_name', 'last_name')) 
     626 
     627    class Admin: 
     628        pass 
     629 
     630# NEW: 
     631class MyModel(models.Model): 
     632    first_name = models.CharField(maxlength=30) 
     633    last_name = models.CharField(maxlength=30) 
     634    slug = models.CharField(maxlength=60, prepopulate_from=('first_name', 'last_name')) 
     635 
     636    class Admin: 
     637        prepopulated_fields = {'slug': ('first_name', 'last_name')} 
     638}}} 
     639 
     640Note that this change was made to the NewformsAdminBranch branch, which is scheduled to merge to trunk by January 31. The change will not be made to trunk until that branch is merged to trunk.