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
a903bc0a
authored
Jan 25, 2010
by
Alex Gaynor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to work with django 1.2
parent
d71c3069
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
+5
-1
taggit/managers.py
+5
-1
No files found.
taggit/managers.py
View file @
a903bc0a
from
collections
import
defaultdict
from
collections
import
defaultdict
import
django
from
django.contrib.contenttypes.models
import
ContentType
from
django.contrib.contenttypes.models
import
ContentType
from
django.db
import
models
from
django.db
import
models
from
django.db.models.fields.related
import
ManyToManyRel
from
django.db.models.fields.related
import
ManyToManyRel
...
@@ -49,7 +50,7 @@ class TaggableManager(object):
...
@@ -49,7 +50,7 @@ class TaggableManager(object):
def
save_form_data
(
self
,
instance
,
value
):
def
save_form_data
(
self
,
instance
,
value
):
getattr
(
instance
,
self
.
name
)
.
set
(
*
value
)
getattr
(
instance
,
self
.
name
)
.
set
(
*
value
)
def
get_
db_
prep_lookup
(
self
,
lookup_type
,
value
):
def
get_prep_lookup
(
self
,
lookup_type
,
value
):
if
lookup_type
!=
"in"
:
if
lookup_type
!=
"in"
:
raise
ValueError
(
"You can't do lookups other than
\"
in
\"
on Tags"
)
raise
ValueError
(
"You can't do lookups other than
\"
in
\"
on Tags"
)
if
all
(
isinstance
(
v
,
Tag
)
for
v
in
value
):
if
all
(
isinstance
(
v
,
Tag
)
for
v
in
value
):
...
@@ -66,6 +67,9 @@ class TaggableManager(object):
...
@@ -66,6 +67,9 @@ class TaggableManager(object):
sql
,
params
=
qs
.
values_list
(
"pk"
,
flat
=
True
)
.
query
.
as_sql
()
sql
,
params
=
qs
.
values_list
(
"pk"
,
flat
=
True
)
.
query
.
as_sql
()
return
QueryWrapper
((
"(
%
s)"
%
sql
),
params
)
return
QueryWrapper
((
"(
%
s)"
%
sql
),
params
)
if
django
.
VERSION
<
(
1
,
2
):
get_db_prep_lookup
=
get_prep_lookup
def
formfield
(
self
,
form_class
=
TagField
,
**
kwargs
):
def
formfield
(
self
,
form_class
=
TagField
,
**
kwargs
):
defaults
=
{
defaults
=
{
"label"
:
"Tags"
,
"label"
:
"Tags"
,
...
...
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