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
de544253
authored
Jul 03, 2013
by
Florian Apolloner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up the TaggableManager constructor.
parent
62525c27
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
19 deletions
+3
-19
taggit/managers.py
+3
-19
No files found.
taggit/managers.py
View file @
de544253
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
django
from
django.contrib.contenttypes.generic
import
GenericRelation
from
django.contrib.contenttypes.generic
import
GenericRelation
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
import
Field
from
django.db.models.fields.related
import
ManyToManyRel
,
RelatedField
,
add_lazy_relation
from
django.db.models.fields.related
import
ManyToManyRel
,
RelatedField
,
add_lazy_relation
from
django.db.models.related
import
RelatedObject
from
django.db.models.related
import
RelatedObject
from
django.utils.text
import
capfirst
from
django.utils.text
import
capfirst
...
@@ -24,28 +24,12 @@ class TaggableRel(ManyToManyRel):
...
@@ -24,28 +24,12 @@ class TaggableRel(ManyToManyRel):
self
.
through
=
None
self
.
through
=
None
class
TaggableManager
(
RelatedField
):
class
TaggableManager
(
RelatedField
,
Field
):
def
__init__
(
self
,
verbose_name
=
_
(
"Tags"
),
def
__init__
(
self
,
verbose_name
=
_
(
"Tags"
),
help_text
=
_
(
"A comma-separated list of tags."
),
through
=
None
,
blank
=
False
):
help_text
=
_
(
"A comma-separated list of tags."
),
through
=
None
,
blank
=
False
):
Field
.
__init__
(
self
,
verbose_name
=
verbose_name
,
help_text
=
help_text
,
blank
=
blank
)
self
.
through
=
through
or
TaggedItem
self
.
through
=
through
or
TaggedItem
self
.
rel
=
TaggableRel
()
self
.
rel
=
TaggableRel
()
self
.
verbose_name
=
verbose_name
self
.
help_text
=
help_text
self
.
blank
=
blank
self
.
editable
=
True
self
.
creates_table
=
False
self
.
db_column
=
None
self
.
serialize
=
False
self
.
null
=
True
self
.
primary_key
=
False
self
.
_choices
=
[]
self
.
_unique
=
False
# Remove once we drop 1.5 support.
if
django
.
VERSION
<
(
1
,
6
):
self
.
choices
=
None
self
.
unique
=
False
self
.
creation_counter
=
models
.
Field
.
creation_counter
models
.
Field
.
creation_counter
+=
1
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
:
...
...
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