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
24b8b7ba
authored
Sep 17, 2013
by
Adam Greig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set serialize=False on TaggableManager to fix tagged object serializing
parent
91791c87
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletions
+6
-1
taggit/managers.py
+1
-1
tests/tests.py
+5
-0
No files found.
taggit/managers.py
View file @
24b8b7ba
...
@@ -73,7 +73,7 @@ class ExtraJoinRestriction(object):
...
@@ -73,7 +73,7 @@ class ExtraJoinRestriction(object):
class
TaggableManager
(
RelatedField
,
Field
):
class
TaggableManager
(
RelatedField
,
Field
):
def
__init__
(
self
,
verbose_name
=
_
(
"Tags"
),
def
__init__
(
self
,
verbose_name
=
_
(
"Tags"
),
help_text
=
_
(
"A comma-separated list of tags."
),
through
=
None
,
blank
=
False
):
help_text
=
_
(
"A comma-separated list of tags."
),
through
=
None
,
blank
=
False
):
Field
.
__init__
(
self
,
verbose_name
=
verbose_name
,
help_text
=
help_text
,
blank
=
blank
)
Field
.
__init__
(
self
,
verbose_name
=
verbose_name
,
help_text
=
help_text
,
blank
=
blank
,
null
=
True
,
serialize
=
False
)
self
.
through
=
through
or
TaggedItem
self
.
through
=
through
or
TaggedItem
self
.
rel
=
TaggableRel
(
self
)
self
.
rel
=
TaggableRel
(
self
)
...
...
tests/tests.py
View file @
24b8b7ba
...
@@ -5,6 +5,7 @@ from unittest import TestCase as UnitTestCase
...
@@ -5,6 +5,7 @@ from unittest import TestCase as UnitTestCase
import
django
import
django
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.exceptions
import
ValidationError
from
django.core.exceptions
import
ValidationError
from
django.core
import
serializers
from
django.db
import
connection
from
django.db
import
connection
from
django.test
import
TestCase
,
TransactionTestCase
from
django.test
import
TestCase
,
TransactionTestCase
from
django.utils
import
six
from
django.utils
import
six
...
@@ -336,6 +337,10 @@ class TaggableManagerTestCase(BaseTaggingTestCase):
...
@@ -336,6 +337,10 @@ class TaggableManagerTestCase(BaseTaggingTestCase):
apple
.
tags
.
add
(
'red'
)
apple
.
tags
.
add
(
'red'
)
self
.
assertEqual
(
list
(
apple
.
tags
.
slugs
()),
[
'green-and-juicy'
,
'red'
])
self
.
assertEqual
(
list
(
apple
.
tags
.
slugs
()),
[
'green-and-juicy'
,
'red'
])
def
test_serializes
(
self
):
apple
=
self
.
food_model
.
objects
.
create
(
name
=
"apple"
)
serializers
.
serialize
(
"json"
,
(
apple
,))
class
TaggableManagerDirectTestCase
(
TaggableManagerTestCase
):
class
TaggableManagerDirectTestCase
(
TaggableManagerTestCase
):
food_model
=
DirectFood
food_model
=
DirectFood
...
...
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