PageRenderTime 65ms CodeModel.GetById 58ms app.highlight 4ms RepoModel.GetById 1ms 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
 1import datetime
 2from django.db import models
 3from django.utils.translation import ugettext_lazy as _
 4
 5def standalone_number(self):
 6    return 1
 7
 8class Numbers(object):
 9    @staticmethod
10    def get_static_number(self):
11        return 2
12
13    @classmethod
14    def get_class_number(self):
15        return 3
16
17    def get_member_number(self):
18        return 4
19
20nn = Numbers()
21
22class Group(models.Model):
23    name = models.CharField(_('name'), max_length=100)
24
25class Event(models.Model):
26    group = models.ForeignKey(Group)
27
28class Happening(models.Model):
29    when = models.DateTimeField(blank=True, default=datetime.datetime.now)
30    name = models.CharField(blank=True, max_length=100, default=lambda:"test")
31    number1 = models.IntegerField(blank=True, default=standalone_number)
32    number2 = models.IntegerField(blank=True, default=Numbers.get_static_number)
33    number3 = models.IntegerField(blank=True, default=Numbers.get_class_number)
34    number4 = models.IntegerField(blank=True, default=nn.get_member_number)