Changes between Version 84 and Version 85 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
Apr 9, 2007, 8:33:53 AM (18 years ago)
Author:
Russell Keith-Magee
Comment:

Added note about removal of LazyDate

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v84 v85  
    1818
    1919 * March 31, 2007: [http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Changedspacelesstemplatetagtoremoveallspaces Changed 'spaceless' template tag to remove all spaces]
    20  * April 8, 2007: Renamed `localflavor.usa` to `localflavor.us`.
     20 * April 8, 2007: [http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Renamedlocalflavor.usatolocalflavor.us Renamed `localflavour.usa` to `localflavor.us`]
     21 * April 9, 2007: [http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#RemovedLazyDate Removed `LazyDate`]
     22
    2123
    2224== Database constraint names changed ==
     
    8284
    8385As always, {{{spaceless}}} only affects space *between* HTML tags, not space within HTML tags or space in plain text.
     86
     87== Renamed `localflavor.usa` to `localflavor.us` ==
     88
     89As of [4954], `localflavor.usa` has been renamed `localflavor.us`. This change was made to match the naming scheme of other local flavors.
     90
     91== Removed `LazyDate` ==
     92
     93The `LazyDate` helper class was removed in [4985]. Default field values and query arguments can both be callable objects, so instances of `LazyDate` can be replaced with a reference to a callable that evaluates to the current date (i.e., `datetime.now`). For example, the following model using `LazyDate`:
     94
     95{{{
     96class Article(models.Model):
     97    title = models.CharField(maxlength=100)
     98    published = models.DateField(default=LazyDate())
     99}}}
     100
     101can be redefined as:
     102
     103{{{
     104from datetime import datetime
     105class Article(models.Model):
     106    title = models.CharField(maxlength=100)
     107    published = models.DateField(default=datetime.now)
     108}}}
     109
     110Note that the new model definition refers to the name of the `datetime.now()` function, but doesn't actually call the function. The call to `datetime.now()` is deferred until the value is actually required (i.e., when the model is saved).
Back to Top