Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-taggit
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
819484fb
authored
Aug 14, 2014
by
Ross McFarland
Committed by
Florian Apolloner
Aug 15, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrations for django 1.7, remove Model from names
parent
5fcbe479
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
+23
-7
tests/migrations/0001_initial.py
+17
-0
tests/models.py
+2
-3
tests/tests.py
+4
-4
No files found.
tests/migrations/0001_initial.py
View file @
819484fb
...
...
@@ -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'
),
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'
,),
),
]
tests/models.py
View file @
819484fb
...
...
@@ -194,10 +194,9 @@ class CustomManager(models.Model):
tags
=
TaggableManager
(
manager
=
Foo
)
class
ParentModel
(
models
.
Model
):
class
Parent
(
models
.
Model
):
tags
=
TaggableManager
()
class
Child
Model
(
ParentModel
):
class
Child
(
Parent
):
pass
tests/tests.py
View file @
819484fb
...
...
@@ -10,7 +10,7 @@ from django.test import TestCase, TransactionTestCase
from
django.utils.encoding
import
force_text
from
.forms
import
CustomPKFoodForm
,
DirectFoodForm
,
FoodForm
,
OfficialFoodForm
from
.models
import
(
Article
,
Child
Model
,
CustomManager
,
CustomPKFood
,
from
.models
import
(
Article
,
Child
,
CustomManager
,
CustomPKFood
,
CustomPKHousePet
,
CustomPKPet
,
DirectFood
,
DirectHousePet
,
DirectPet
,
Food
,
HousePet
,
Movie
,
OfficialFood
,
OfficialHousePet
,
OfficialPet
,
...
...
@@ -585,14 +585,14 @@ class SouthSupportTests(TestCase):
class
InheritedPrefetchTests
(
TestCase
):
def
test_inherited_tags_with_prefetch
(
self
):
child
=
Child
Model
()
child
=
Child
()
child
.
save
()
child
.
tags
.
add
(
'tag 1'
,
'tag 2'
,
'tag 3'
,
'tag 4'
)
child
=
Child
Model
.
objects
.
get
()
child
=
Child
.
objects
.
get
()
no_prefetch_tags
=
child
.
tags
.
all
()
self
.
assertEquals
(
4
,
no_prefetch_tags
.
count
())
child
=
Child
Model
.
objects
.
prefetch_related
(
'tags'
)
.
get
()
child
=
Child
.
objects
.
prefetch_related
(
'tags'
)
.
get
()
prefetch_tags
=
child
.
tags
.
all
()
self
.
assertEquals
(
4
,
prefetch_tags
.
count
())
self
.
assertEquals
(
set
([
t
.
name
for
t
in
no_prefetch_tags
]),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment