1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

[1.1.X] Fixed #12057 -- Corrected regression of caching performance when 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
This commit is contained in:
Russell Keith-Magee
2009-10-29 14:36:10 +00:00
parent b1151bc2b3
commit 72933294d2
4 changed files with 64 additions and 3 deletions

View File

@@ -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)