-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.1.X] Fixed #12057 -- Corrected regression of caching performance w…
…hen a model contained a callable default. Thanks to Michael Thornhill for the excellent assistance tracking this problem. Backport of r11681 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@11682 bcc190cf-cafb-0310-a4f2-bffc1f526a37
- Loading branch information
1 parent
b1151bc
commit 7293329
Showing
4 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.db import models | ||
from datetime import datetime | ||
|
||
def expensive_calculation(): | ||
expensive_calculation.num_runs += 1 | ||
return datetime.now() | ||
|
||
class Poll(models.Model): | ||
question = models.CharField(max_length=200) | ||
answer = models.CharField(max_length=200) | ||
pub_date = models.DateTimeField('date published', default=expensive_calculation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters