parts/django/tests/regressiontests/null_queries/models.py
changeset 307 c6bca38c1cbf
equal deleted inserted replaced
306:5ff1fc726848 307:c6bca38c1cbf
       
     1 from django.db import models
       
     2 
       
     3 class Poll(models.Model):
       
     4     question = models.CharField(max_length=200)
       
     5 
       
     6     def __unicode__(self):
       
     7         return u"Q: %s " % self.question
       
     8 
       
     9 class 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.
       
    17 class OuterA(models.Model):
       
    18     pass
       
    19 
       
    20 class OuterB(models.Model):
       
    21     data = models.CharField(max_length=10)
       
    22 
       
    23 class Inner(models.Model):
       
    24     first = models.ForeignKey(OuterA)
       
    25     second = models.ForeignKey(OuterB, null=True)