Commit 819484fb by Ross McFarland Committed by Florian Apolloner

migrations for django 1.7, remove Model from names

parent 5fcbe479
...@@ -448,4 +448,21 @@ class Migration(migrations.Migration): ...@@ -448,4 +448,21 @@ class Migration(migrations.Migration):
field=taggit.managers.TaggableManager(to='taggit.Tag', through='tests.ArticleTaggedItem', help_text='A comma-separated list of tags.', verbose_name='Tags'), field=taggit.managers.TaggableManager(to='taggit.Tag', through='tests.ArticleTaggedItem', help_text='A comma-separated list of tags.', verbose_name='Tags'),
preserve_default=True, preserve_default=True,
), ),
migrations.CreateModel(
name='Parent',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Child',
fields=[
],
options={
},
bases=('tests.Parent',),
),
] ]
...@@ -194,10 +194,9 @@ class CustomManager(models.Model): ...@@ -194,10 +194,9 @@ class CustomManager(models.Model):
tags = TaggableManager(manager=Foo) tags = TaggableManager(manager=Foo)
class Parent(models.Model):
class ParentModel(models.Model):
tags = TaggableManager() tags = TaggableManager()
class ChildModel(ParentModel): class Child(Parent):
pass pass
...@@ -10,7 +10,7 @@ from django.test import TestCase, TransactionTestCase ...@@ -10,7 +10,7 @@ from django.test import TestCase, TransactionTestCase
from django.utils.encoding import force_text from django.utils.encoding import force_text
from .forms import CustomPKFoodForm, DirectFoodForm, FoodForm, OfficialFoodForm from .forms import CustomPKFoodForm, DirectFoodForm, FoodForm, OfficialFoodForm
from .models import (Article, ChildModel, CustomManager, CustomPKFood, from .models import (Article, Child, CustomManager, CustomPKFood,
CustomPKHousePet, CustomPKPet, DirectFood, CustomPKHousePet, CustomPKPet, DirectFood,
DirectHousePet, DirectPet, Food, HousePet, Movie, DirectHousePet, DirectPet, Food, HousePet, Movie,
OfficialFood, OfficialHousePet, OfficialPet, OfficialFood, OfficialHousePet, OfficialPet,
...@@ -585,14 +585,14 @@ class SouthSupportTests(TestCase): ...@@ -585,14 +585,14 @@ class SouthSupportTests(TestCase):
class InheritedPrefetchTests(TestCase): class InheritedPrefetchTests(TestCase):
def test_inherited_tags_with_prefetch(self): def test_inherited_tags_with_prefetch(self):
child = ChildModel() child = Child()
child.save() child.save()
child.tags.add('tag 1', 'tag 2', 'tag 3', 'tag 4') child.tags.add('tag 1', 'tag 2', 'tag 3', 'tag 4')
child = ChildModel.objects.get() child = Child.objects.get()
no_prefetch_tags = child.tags.all() no_prefetch_tags = child.tags.all()
self.assertEquals(4, no_prefetch_tags.count()) self.assertEquals(4, no_prefetch_tags.count())
child = ChildModel.objects.prefetch_related('tags').get() child = Child.objects.prefetch_related('tags').get()
prefetch_tags = child.tags.all() prefetch_tags = child.tags.all()
self.assertEquals(4, prefetch_tags.count()) self.assertEquals(4, prefetch_tags.count())
self.assertEquals(set([t.name for t in no_prefetch_tags]), self.assertEquals(set([t.name for t in no_prefetch_tags]),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment