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
f7fad676
authored
Feb 07, 2010
by
Alex Gaynor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct an issue with saving tags when no tags were includded in a form.
parent
32a5bcc8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
taggit/tests/tests.py
+6
-0
taggit/utils.py
+2
-0
No files found.
taggit/tests/tests.py
View file @
f7fad676
...
@@ -88,6 +88,11 @@ class TaggableFormTestCase(BaseTaggingTest):
...
@@ -88,6 +88,11 @@ class TaggableFormTestCase(BaseTaggingTest):
apple
=
Food
.
objects
.
get
(
name
=
'apple'
)
apple
=
Food
.
objects
.
get
(
name
=
'apple'
)
self
.
assert_tags_equal
(
apple
.
tags
.
all
(),
[
'green'
,
'red'
,
'yummy'
,
'delicious'
])
self
.
assert_tags_equal
(
apple
.
tags
.
all
(),
[
'green'
,
'red'
,
'yummy'
,
'delicious'
])
self
.
assertEqual
(
Food
.
objects
.
count
(),
1
)
self
.
assertEqual
(
Food
.
objects
.
count
(),
1
)
f
=
FoodForm
({
"name"
:
"raspberry"
})
raspberry
=
f
.
save
()
self
.
assert_tags_equal
(
raspberry
.
tags
.
all
(),
[])
class
SimilarityByTagTestCase
(
BaseTaggingTest
):
class
SimilarityByTagTestCase
(
BaseTaggingTest
):
def
test_similarity_by_tag
(
self
):
def
test_similarity_by_tag
(
self
):
...
@@ -105,6 +110,7 @@ class SimilarityByTagTestCase(BaseTaggingTest):
...
@@ -105,6 +110,7 @@ class SimilarityByTagTestCase(BaseTaggingTest):
self
.
assertEqual
(
similar_objs
,
[
pear
,
watermelon
])
self
.
assertEqual
(
similar_objs
,
[
pear
,
watermelon
])
self
.
assertEqual
(
map
(
lambda
x
:
x
.
similar_tags
,
similar_objs
),
[
3
,
2
])
self
.
assertEqual
(
map
(
lambda
x
:
x
.
similar_tags
,
similar_objs
),
[
3
,
2
])
class
TagReuseTestCase
(
BaseTaggingTest
):
class
TagReuseTestCase
(
BaseTaggingTest
):
def
test_tag_reuse
(
self
):
def
test_tag_reuse
(
self
):
apple
=
Food
.
objects
.
create
(
name
=
"apple"
)
apple
=
Food
.
objects
.
create
(
name
=
"apple"
)
...
...
taggit/utils.py
View file @
f7fad676
from
functools
import
wraps
from
functools
import
wraps
def
parse_tags
(
tags
):
def
parse_tags
(
tags
):
if
tags
is
None
:
tags
=
""
return
[
o
.
strip
()
for
o
in
tags
.
split
(
','
)
if
o
.
strip
()]
return
[
o
.
strip
()
for
o
in
tags
.
split
(
','
)
if
o
.
strip
()]
def
require_instance_manager
(
func
):
def
require_instance_manager
(
func
):
...
...
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