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
e9b9de1b
authored
Mar 21, 2014
by
Nicholas Serra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow pluggable manager for TaggableManager.
parent
e6c90946
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
taggit/managers.py
+3
-2
No files found.
taggit/managers.py
View file @
e9b9de1b
...
@@ -73,17 +73,18 @@ class TaggableManager(RelatedField, Field):
...
@@ -73,17 +73,18 @@ class TaggableManager(RelatedField, Field):
_related_name_counter
=
0
_related_name_counter
=
0
def
__init__
(
self
,
verbose_name
=
_
(
"Tags"
),
help_text
=
_
(
"A comma-separated list of tags."
),
def
__init__
(
self
,
verbose_name
=
_
(
"Tags"
),
help_text
=
_
(
"A comma-separated list of tags."
),
through
=
None
,
blank
=
False
,
related_name
=
None
):
through
=
None
,
blank
=
False
,
related_name
=
None
,
manager
=
None
):
Field
.
__init__
(
self
,
verbose_name
=
verbose_name
,
help_text
=
help_text
,
blank
=
blank
,
null
=
True
,
serialize
=
False
)
Field
.
__init__
(
self
,
verbose_name
=
verbose_name
,
help_text
=
help_text
,
blank
=
blank
,
null
=
True
,
serialize
=
False
)
self
.
through
=
through
or
TaggedItem
self
.
through
=
through
or
TaggedItem
self
.
rel
=
TaggableRel
(
self
,
related_name
,
self
.
through
)
self
.
rel
=
TaggableRel
(
self
,
related_name
,
self
.
through
)
self
.
swappable
=
False
self
.
swappable
=
False
self
.
manager
=
manager
or
_TaggableManager
def
__get__
(
self
,
instance
,
model
):
def
__get__
(
self
,
instance
,
model
):
if
instance
is
not
None
and
instance
.
pk
is
None
:
if
instance
is
not
None
and
instance
.
pk
is
None
:
raise
ValueError
(
"
%
s objects need to have a primary key value "
raise
ValueError
(
"
%
s objects need to have a primary key value "
"before you can access their tags."
%
model
.
__name__
)
"before you can access their tags."
%
model
.
__name__
)
manager
=
_TaggableM
anager
(
manager
=
self
.
m
anager
(
through
=
self
.
through
,
through
=
self
.
through
,
model
=
model
,
model
=
model
,
instance
=
instance
,
instance
=
instance
,
...
...
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