diff --git a/tests/modeltests/many_to_one/models.py b/tests/modeltests/many_to_one/models.py
index dfb17b8..434fa2e 100644
a
|
b
|
class Article(models.Model):
|
25 | 25 | class Meta: |
26 | 26 | ordering = ('headline',) |
27 | 27 | |
| 28 | class Category(models.Model): |
| 29 | name = models.CharField(max_length=20) |
| 30 | |
| 31 | class Record(models.Model): |
| 32 | category = models.ForeignKey(Category) |
| 33 | |
| 34 | class Relation(models.Model): |
| 35 | left = models.ForeignKey(Record, related_name='left_set') |
| 36 | right = models.ForeignKey(Record, related_name='right_set') |
| 37 | |
28 | 38 | __test__ = {'API_TESTS':""" |
29 | 39 | # Create a few Reporters. |
30 | 40 | >>> r = Reporter(first_name='John', last_name='Smith', email='john@example.com') |
… |
… |
True
|
292 | 302 | [datetime.datetime(1980, 4, 1, 0, 0)] |
293 | 303 | >>> Article.objects.select_related().dates('pub_date', 'year') |
294 | 304 | [datetime.datetime(1980, 1, 1, 0, 0)] |
| 305 | |
| 306 | # Test of multiple ForeignKeys to the same model |
| 307 | # Add some categories/records/relations |
| 308 | |
| 309 | >>> c1 = Category.objects.create(name='First') |
| 310 | >>> c2 = Category.objects.create(name='Second') |
| 311 | >>> r1 = Record.objects.create(category=c1) |
| 312 | >>> r2 = Record.objects.create(category=c1) |
| 313 | >>> r3 = Record.objects.create(category=c2) |
| 314 | >>> r4 = Record.objects.create(category=c2) |
| 315 | >>> r = Relation.objects.create(left=r1, right=r2) |
| 316 | >>> r = Relation.objects.create(left=r3, right=r4) |
| 317 | >>> r = Relation.objects.create(left=r1, right=r3) |
| 318 | |
| 319 | # Yields wrong sql |
| 320 | >>> Relation.objects.filter(left__category__name__in=['Second'], right__category__name__in=['First']).query.as_sql() |
| 321 | |
295 | 322 | """} |