diff options
| author | Jason Myers <jason@jasonamyers.com> | 2013-11-02 16:34:05 -0500 |
|---|---|---|
| committer | Jason Myers <jason@jasonamyers.com> | 2013-11-02 23:48:47 -0500 |
| commit | c3791463a5a9674f8e0148fbab57eae23c138896 (patch) | |
| tree | 6606acdb74132a344a49e910dec5d0356389a569 /tests/unmanaged_models | |
| parent | 2a03a9a9a1c4517be75e72899e545b0bc9dd0688 (diff) | |
Fixing E302 Errors
Signed-off-by: Jason Myers <jason@jasonamyers.com>
Diffstat (limited to 'tests/unmanaged_models')
| -rw-r--r-- | tests/unmanaged_models/models.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/unmanaged_models/models.py b/tests/unmanaged_models/models.py index 0eef69977c..b0dd5c8719 100644 --- a/tests/unmanaged_models/models.py +++ b/tests/unmanaged_models/models.py @@ -8,6 +8,7 @@ from django.utils.encoding import python_2_unicode_compatible # All of these models are created in the database by Django. + @python_2_unicode_compatible class A01(models.Model): f_a = models.CharField(max_length=10, db_index=True) @@ -19,6 +20,7 @@ class A01(models.Model): def __str__(self): return self.f_a + @python_2_unicode_compatible class B01(models.Model): fk_a = models.ForeignKey(A01) @@ -33,6 +35,7 @@ class B01(models.Model): def __str__(self): return self.f_a + @python_2_unicode_compatible class C01(models.Model): mm_a = models.ManyToManyField(A01, db_table='d01') @@ -49,6 +52,7 @@ class C01(models.Model): # of possibly a subset of the columns). There should be no creation errors, # since we have told Django they aren't managed by Django. + @python_2_unicode_compatible class A02(models.Model): f_a = models.CharField(max_length=10, db_index=True) @@ -60,6 +64,7 @@ class A02(models.Model): def __str__(self): return self.f_a + @python_2_unicode_compatible class B02(models.Model): class Meta: @@ -73,6 +78,7 @@ class B02(models.Model): def __str__(self): return self.f_a + # To re-use the many-to-many intermediate table, we need to manually set up # things up. @python_2_unicode_compatible @@ -88,6 +94,7 @@ class C02(models.Model): def __str__(self): return self.f_a + class Intermediate(models.Model): a02 = models.ForeignKey(A02, db_column="a01_id") c02 = models.ForeignKey(C02, db_column="c01_id") @@ -96,7 +103,7 @@ class Intermediate(models.Model): db_table = 'd01' managed = False -# + # These next models test the creation (or not) of many to many join tables # between managed and unmanaged models. A join table between two unmanaged # models shouldn't be automatically created (see #10647). @@ -109,15 +116,18 @@ class Proxy1(models.Model): class Meta: db_table = "unmanaged_models_proxy1" + class Proxy2(models.Model): class Meta: db_table = "unmanaged_models_proxy2" + class Unmanaged1(models.Model): class Meta: managed = False db_table = "unmanaged_models_proxy1" + # Unmanged with an m2m to unmanaged: the intermediary table won't be created. class Unmanaged2(models.Model): mm = models.ManyToManyField(Unmanaged1) @@ -126,6 +136,7 @@ class Unmanaged2(models.Model): managed = False db_table = "unmanaged_models_proxy2" + # Here's an unmanaged model with an m2m to a managed one; the intermediary # table *will* be created (unless given a custom `through` as for C02 above). class Managed1(models.Model): |
