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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
aef86c2b
authored
Feb 03, 2010
by
Alex Gaynor
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit 'origin/master'
parents
8cbf7280
ab8b54f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
taggit/managers.py
+1
-1
taggit/tests/__init__.py
+1
-1
taggit/tests/tests.py
+6
-0
No files found.
taggit/managers.py
View file @
aef86c2b
...
...
@@ -127,7 +127,7 @@ class _TaggableManager(models.Manager):
for
tag
in
tags
:
if
not
isinstance
(
tag
,
Tag
):
tag
,
_
=
Tag
.
objects
.
get_or_create
(
name
=
tag
)
TaggedItem
.
objects
.
create
(
object_id
=
self
.
object_id
,
TaggedItem
.
objects
.
get_or_
create
(
object_id
=
self
.
object_id
,
content_type
=
ContentType
.
objects
.
get_for_model
(
self
.
model
),
tag
=
tag
)
@require_instance_manager
...
...
taggit/tests/__init__.py
View file @
aef86c2b
from
taggit.tests.tests
import
AddTagTestCase
,
LookupByTagTestCase
,
TaggableFormTestCase
,
SimilarityByTagTestCase
from
taggit.tests.tests
import
AddTagTestCase
,
LookupByTagTestCase
,
TaggableFormTestCase
,
SimilarityByTagTestCase
,
TagReuseTestCase
taggit/tests/tests.py
View file @
aef86c2b
...
...
@@ -104,3 +104,9 @@ class SimilarityByTagTestCase(BaseTaggingTest):
similar_objs
=
apple
.
tags
.
similar_objects
()
self
.
assertEqual
(
similar_objs
,
[
pear
,
watermelon
])
self
.
assertEqual
(
map
(
lambda
x
:
x
.
similar_tags
,
similar_objs
),
[
3
,
2
])
class
TagReuseTestCase
(
BaseTaggingTest
):
def
test_tag_reuse
(
self
):
apple
=
Food
.
objects
.
create
(
name
=
"apple"
)
apple
.
tags
.
add
(
"juicy"
,
"juicy"
)
self
.
assert_tags_equal
(
apple
.
tags
.
all
(),
[
'juicy'
])
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