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

/tests/regressiontests/queryset_pickle/models.py

https://code.google.com/p/mango-py/
Python | 34 lines | 26 code | 8 blank | 0 comment | 0 complexity | ffa05f7a79aee187bd3b97b2b5b338be MD5 | raw file
Possible License(s): BSD-3-Clause
  1. import datetime
  2. from django.db import models
  3. from django.utils.translation import ugettext_lazy as _
  4. def standalone_number(self):
  5. return 1
  6. class Numbers(object):
  7. @staticmethod
  8. def get_static_number(self):
  9. return 2
  10. @classmethod
  11. def get_class_number(self):
  12. return 3
  13. def get_member_number(self):
  14. return 4
  15. nn = Numbers()
  16. class Group(models.Model):
  17. name = models.CharField(_('name'), max_length=100)
  18. class Event(models.Model):
  19. group = models.ForeignKey(Group)
  20. class Happening(models.Model):
  21. when = models.DateTimeField(blank=True, default=datetime.datetime.now)
  22. name = models.CharField(blank=True, max_length=100, default=lambda:"test")
  23. number1 = models.IntegerField(blank=True, default=standalone_number)
  24. number2 = models.IntegerField(blank=True, default=Numbers.get_static_number)
  25. number3 = models.IntegerField(blank=True, default=Numbers.get_class_number)
  26. number4 = models.IntegerField(blank=True, default=nn.get_member_number)