PageRenderTime 102ms CodeModel.GetById 60ms app.highlight 3ms RepoModel.GetById 38ms app.codeStats 0ms

/tests/regressiontests/null_queries/models.py

https://code.google.com/p/mango-py/
Python | 25 lines | 17 code | 7 blank | 1 comment | 0 complexity | 39610ac2e20d6e82e3bc6c3bf80969b5 MD5 | raw file
 1from django.db import models
 2
 3class Poll(models.Model):
 4    question = models.CharField(max_length=200)
 5
 6    def __unicode__(self):
 7        return u"Q: %s " % self.question
 8
 9class Choice(models.Model):
10    poll = models.ForeignKey(Poll)
11    choice = models.CharField(max_length=200)
12
13    def __unicode__(self):
14        return u"Choice: %s in poll %s" % (self.choice, self.poll)
15
16# A set of models with an inner one pointing to two outer ones.
17class OuterA(models.Model):
18    pass
19
20class OuterB(models.Model):
21    data = models.CharField(max_length=10)
22
23class Inner(models.Model):
24    first = models.ForeignKey(OuterA)
25    second = models.ForeignKey(OuterB, null=True)