| | 86 | |
| | 87 | == Renamed `localflavor.usa` to `localflavor.us` == |
| | 88 | |
| | 89 | As 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 | |
| | 93 | The `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 | {{{ |
| | 96 | class Article(models.Model): |
| | 97 | title = models.CharField(maxlength=100) |
| | 98 | published = models.DateField(default=LazyDate()) |
| | 99 | }}} |
| | 100 | |
| | 101 | can be redefined as: |
| | 102 | |
| | 103 | {{{ |
| | 104 | from datetime import datetime |
| | 105 | class Article(models.Model): |
| | 106 | title = models.CharField(maxlength=100) |
| | 107 | published = models.DateField(default=datetime.now) |
| | 108 | }}} |
| | 109 | |
| | 110 | Note 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). |