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:
11
tests/regressiontests/cache/models.py
vendored
11
tests/regressiontests/cache/models.py
vendored
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user