equal
deleted
inserted
replaced
|
1 """ |
|
2 Tests for the order_with_respect_to Meta attribute. |
|
3 """ |
|
4 |
|
5 from django.db import models |
|
6 |
|
7 |
|
8 class Question(models.Model): |
|
9 text = models.CharField(max_length=200) |
|
10 |
|
11 class Answer(models.Model): |
|
12 text = models.CharField(max_length=200) |
|
13 question = models.ForeignKey(Question) |
|
14 |
|
15 class Meta: |
|
16 order_with_respect_to = 'question' |
|
17 |
|
18 def __unicode__(self): |
|
19 return unicode(self.text) |
|
20 |
|
21 class Post(models.Model): |
|
22 title = models.CharField(max_length=200) |
|
23 parent = models.ForeignKey("self", related_name="children", null=True) |
|
24 |
|
25 class Meta: |
|
26 order_with_respect_to = "parent" |
|
27 |
|
28 def __unicode__(self): |
|
29 return self.title |