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
10923624
authored
Aug 16, 2013
by
Florian Apolloner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed 1.7 deprecation warnings.
parent
095cb153
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
taggit/managers.py
+10
-2
tests/tests.py
+2
-2
No files found.
taggit/managers.py
View file @
10923624
...
...
@@ -21,6 +21,13 @@ from taggit.models import TaggedItem, GenericTaggedItemBase
from
taggit.utils
import
require_instance_manager
def
_model_name
(
model
):
if
VERSION
<
(
1
,
7
):
return
model
.
_meta
.
module_name
else
:
return
model
.
_meta
.
model_name
class
TaggableRel
(
ManyToManyRel
):
def
__init__
(
self
,
field
):
self
.
related_name
=
None
...
...
@@ -128,7 +135,7 @@ class TaggableManager(RelatedField, Field):
return
self
.
through
.
objects
.
none
()
def
related_query_name
(
self
):
return
self
.
model
.
_meta
.
module_name
return
_model_name
(
self
.
model
)
def
m2m_reverse_name
(
self
):
return
self
.
through
.
_meta
.
get_field_by_name
(
"tag"
)[
0
]
.
column
...
...
@@ -167,7 +174,8 @@ class TaggableManager(RelatedField, Field):
return
[(
"
%
s__content_type__in"
%
prefix
,
cts
)]
def
get_extra_join_sql
(
self
,
connection
,
qn
,
lhs_alias
,
rhs_alias
):
if
rhs_alias
==
'
%
s_
%
s'
%
(
self
.
through
.
_meta
.
app_label
,
self
.
through
.
_meta
.
module_name
):
model_name
=
_model_name
(
self
.
through
)
if
rhs_alias
==
'
%
s_
%
s'
%
(
self
.
through
.
_meta
.
app_label
,
model_name
):
alias_to_join
=
rhs_alias
else
:
alias_to_join
=
lhs_alias
...
...
tests/tests.py
View file @
10923624
...
...
@@ -12,7 +12,7 @@ from django.utils.encoding import force_text
from
django.contrib.contenttypes.models
import
ContentType
from
taggit.managers
import
TaggableManager
from
taggit.managers
import
TaggableManager
,
_model_name
from
taggit.models
import
Tag
,
TaggedItem
from
.forms
import
(
FoodForm
,
DirectFoodForm
,
CustomPKFoodForm
,
OfficialFoodForm
)
...
...
@@ -285,7 +285,7 @@ class TaggableManagerTestCase(BaseTaggingTestCase):
spot
.
tags
.
add
(
'scary'
)
spike
.
tags
.
add
(
'fluffy'
)
lookup_kwargs
=
{
'
%
s__name'
%
self
.
pet_model
.
_meta
.
module_name
:
'Spot'
'
%
s__name'
%
_model_name
(
self
.
pet_model
)
:
'Spot'
}
self
.
assert_tags_equal
(
self
.
tag_model
.
objects
.
filter
(
**
lookup_kwargs
),
...
...
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