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
8eb936a2
authored
Jan 13, 2010
by
Alex Gaynor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a potential issue in a multi-model scenario
parent
d513882d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
taggit/managers.py
+8
-5
No files found.
taggit/managers.py
View file @
8eb936a2
...
@@ -139,11 +139,14 @@ class _TaggableManager(models.Manager):
...
@@ -139,11 +139,14 @@ class _TaggableManager(models.Manager):
@require_instance_manager
@require_instance_manager
def
similar_objects
(
self
):
def
similar_objects
(
self
):
qs
=
TaggedItem
.
objects
.
values
(
'object_id'
,
'content_type'
)
\
qs
=
TaggedItem
.
objects
.
values
(
'object_id'
,
'content_type'
)
.
annotate
(
n
=
models
.
Count
(
'pk'
))
\
qs
=
qs
.
annotate
(
n
=
models
.
Count
(
'pk'
))
.
exclude
(
object_id
=
self
.
object_id
)
\
qs
=
qs
.
exclude
(
.
filter
(
tag__in
=
self
.
all
())
\
object_id
=
self
.
object_id
,
.
order_by
(
'-n'
)
content_type
=
ContentType
.
objects
.
get_for_model
(
self
.
model
)
)
qs
=
qs
.
filter
(
tag__in
=
self
.
all
())
qs
=
qs
.
order_by
(
'-n'
)
preload
=
defaultdict
(
set
)
preload
=
defaultdict
(
set
)
for
result
in
qs
:
for
result
in
qs
:
...
...
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