PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/regressiontests/cache/models.py

https://code.google.com/p/mango-py/
Python | 11 lines | 9 code | 2 blank | 0 comment | 0 complexity | e3eca1fa7e375fd3fdd82f69c4214b56 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. from django.db import models
  2. from datetime import datetime
  3. def expensive_calculation():
  4. expensive_calculation.num_runs += 1
  5. return datetime.now()
  6. class Poll(models.Model):
  7. question = models.CharField(max_length=200)
  8. answer = models.CharField(max_length=200)
  9. pub_date = models.DateTimeField('date published', default=expensive_calculation)