PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 4ms RepoModel.GetById 36ms app.codeStats 0ms

/tests/regressiontests/admin_util/models.py

https://code.google.com/p/mango-py/
Python | 37 lines | 25 code | 9 blank | 3 comment | 0 complexity | 6cbec457869aba2663ec74e1a02c739e MD5 | raw file
 1from django.db import models
 2
 3class Article(models.Model):
 4    """
 5    A simple Article model for testing
 6    """
 7    site = models.ForeignKey('sites.Site', related_name="admin_articles")
 8    title = models.CharField(max_length=100)
 9    title2 = models.CharField(max_length=100, verbose_name="another name")
10    created = models.DateTimeField()
11
12    def test_from_model(self):
13        return "nothing"
14
15    def test_from_model_with_override(self):
16        return "nothing"
17    test_from_model_with_override.short_description = "not What you Expect"
18
19class Count(models.Model):
20    num = models.PositiveSmallIntegerField()
21    parent = models.ForeignKey('self', null=True)
22
23    def __unicode__(self):
24        return unicode(self.num)
25
26class Event(models.Model):
27    date = models.DateTimeField(auto_now_add=True)
28
29class Location(models.Model):
30    event = models.OneToOneField(Event, verbose_name='awesome event')
31
32class Guest(models.Model):
33    event = models.OneToOneField(Event)
34    name = models.CharField(max_length=255)
35
36    class Meta:
37        verbose_name = "awesome guest"