App Engine Python SDK version 1.7.4 (2)
[gae.git] / python / lib / django_1_4 / tests / modeltests / order_with_respect_to / models.py
blob59f01d4cd14668b85c86b428e90c98e8fed89566
1 """
2 Tests for the order_with_respect_to Meta attribute.
3 """
5 from django.db import models
8 class Question(models.Model):
9 text = models.CharField(max_length=200)
11 class Answer(models.Model):
12 text = models.CharField(max_length=200)
13 question = models.ForeignKey(Question)
15 class Meta:
16 order_with_respect_to = 'question'
18 def __unicode__(self):
19 return unicode(self.text)
21 class Post(models.Model):
22 title = models.CharField(max_length=200)
23 parent = models.ForeignKey("self", related_name="children", null=True)
25 class Meta:
26 order_with_respect_to = "parent"
28 def __unicode__(self):
29 return self.title