summaryrefslogtreecommitdiff
path: root/tests/cache/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cache/models.py')
-rw-r--r--tests/cache/models.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/cache/models.py b/tests/cache/models.py
new file mode 100644
index 0000000000..2cd648b780
--- /dev/null
+++ b/tests/cache/models.py
@@ -0,0 +1,13 @@
+from django.utils import timezone
+
+from django.db import models
+
+
+def expensive_calculation():
+ expensive_calculation.num_runs += 1
+ return timezone.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)