mirror of
https://github.com/django/django.git
synced 2025-11-25 21:22:14 +00:00
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.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11681 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c5c7791e91
commit
96658ef2d2
4 changed files with 64 additions and 3 deletions
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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue