2 Tests for the order_with_respect_to Meta attribute.
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
)
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)
26 order_with_respect_to
= "parent"
28 def __unicode__(self
):