~ubuntu-branches/ubuntu/oneiric/python-django/oneiric

« back to all changes in this revision

Viewing changes to tests/regressiontests/cache/models.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2010-05-21 07:52:55 UTC
  • mfrom: (1.1.10 upstream) (4.4.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100521075255-i1zpeyc0k8512pd7
Tags: 1.2-1
New upstream stable release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from django.db import models
 
2
from datetime import datetime
 
3
 
 
4
def expensive_calculation():
 
5
    expensive_calculation.num_runs += 1
 
6
    return datetime.now()
 
7
 
 
8
class Poll(models.Model):
 
9
    question = models.CharField(max_length=200)
 
10
    answer = models.CharField(max_length=200)
 
11
    pub_date = models.DateTimeField('date published', default=expensive_calculation)