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
15407771
authored
Dec 31, 2013
by
Thomas Schreiber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverse to make the current standard of 'queryset' the default
parent
c79305a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
taggit/managers.py
+9
-9
No files found.
taggit/managers.py
View file @
15407771
...
...
@@ -289,13 +289,13 @@ class _TaggableManager(models.Manager):
def
is_cached
(
self
,
instance
):
return
self
.
prefetch_cache_name
in
instance
.
_prefetched_objects_cache
def
get_query
_
set
(
self
):
def
get_queryset
(
self
):
try
:
return
self
.
instance
.
_prefetched_objects_cache
[
self
.
prefetch_cache_name
]
except
(
AttributeError
,
KeyError
):
return
self
.
through
.
tags_for
(
self
.
model
,
self
.
instance
)
def
get_prefetch_query
_set
(
self
,
instances
,
queryset
=
None
):
def
get_prefetch_query
set
(
self
,
instances
,
queryset
=
None
):
if
queryset
is
not
None
:
raise
ValueError
(
"Custom queryset can't be used for this lookup."
)
...
...
@@ -314,7 +314,7 @@ class _TaggableManager(models.Manager):
source_col
=
fk
.
column
connection
=
connections
[
db
]
qn
=
connection
.
ops
.
quote_name
qs
=
self
.
get_query
_
set
()
.
using
(
db
)
.
_next_is_sticky
()
.
filter
(
**
query
)
.
extra
(
qs
=
self
.
get_queryset
()
.
using
(
db
)
.
_next_is_sticky
()
.
filter
(
**
query
)
.
extra
(
select
=
{
'_prefetch_related_val'
:
'
%
s.
%
s'
%
(
qn
(
join_table
),
qn
(
source_col
))
}
...
...
@@ -325,9 +325,9 @@ class _TaggableManager(models.Manager):
False
,
self
.
prefetch_cache_name
)
# Django
1.6 renamed this
get_query
set
=
get_query_
set
get_prefetch_query
set
=
get_prefetch_query_
set
# Django
< 1.6 uses the previous name of query_set
get_query
_set
=
get_query
set
get_prefetch_query
_set
=
get_prefetch_query
set
def
_lookup_kwargs
(
self
):
return
self
.
through
.
lookup_kwargs
(
self
.
instance
)
...
...
@@ -355,11 +355,11 @@ class _TaggableManager(models.Manager):
@require_instance_manager
def
names
(
self
):
return
self
.
get_query
_
set
()
.
values_list
(
'name'
,
flat
=
True
)
return
self
.
get_queryset
()
.
values_list
(
'name'
,
flat
=
True
)
@require_instance_manager
def
slugs
(
self
):
return
self
.
get_query
_
set
()
.
values_list
(
'slug'
,
flat
=
True
)
return
self
.
get_queryset
()
.
values_list
(
'slug'
,
flat
=
True
)
@require_instance_manager
def
set
(
self
,
*
tags
):
...
...
@@ -376,7 +376,7 @@ class _TaggableManager(models.Manager):
self
.
through
.
objects
.
filter
(
**
self
.
_lookup_kwargs
())
.
delete
()
def
most_common
(
self
):
return
self
.
get_query
_
set
()
.
annotate
(
return
self
.
get_queryset
()
.
annotate
(
num_times
=
models
.
Count
(
self
.
through
.
tag_relname
())
)
.
order_by
(
'-num_times'
)
...
...
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