thirdparty/google_appengine/lib/django/tests/regressiontests/many_to_one_regress/models.py
equal
deleted
inserted
replaced
1 from django.db import models |
|
2 |
|
3 # If ticket #1578 ever slips back in, these models will not be able to be |
|
4 # created (the field names being lower-cased versions of their opposite |
|
5 # classes is important here). |
|
6 |
|
7 class First(models.Model): |
|
8 second = models.IntegerField() |
|
9 |
|
10 class Second(models.Model): |
|
11 first = models.ForeignKey(First, related_name = 'the_first') |
|
12 |
|
13 # Protect against repetition of #1839, #2415 and #2536. |
|
14 class Third(models.Model): |
|
15 name = models.CharField(maxlength=20) |
|
16 third = models.ForeignKey('self', null=True, related_name='child_set') |
|
17 |
|
18 class Parent(models.Model): |
|
19 name = models.CharField(maxlength=20) |
|
20 bestchild = models.ForeignKey('Child', null=True, related_name='favored_by') |
|
21 |
|
22 class Child(models.Model): |
|
23 name = models.CharField(maxlength=20) |
|
24 parent = models.ForeignKey(Parent) |
|
25 |
|
26 |
|
27 __test__ = {'API_TESTS':""" |
|
28 >>> Third.AddManipulator().save(dict(id='3', name='An example', another=None)) |
|
29 <Third: Third object> |
|
30 >>> parent = Parent(name = 'fred') |
|
31 >>> parent.save() |
|
32 >>> Child.AddManipulator().save(dict(name='bam-bam', parent=parent.id)) |
|
33 <Child: Child object> |
|
34 """} |
|