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
543471cd
authored
Sep 07, 2010
by
Alex Gaynor
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'origin/master'
parents
377bb478
18566407
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
4 additions
and
10 deletions
+4
-10
taggit/forms.py
+0
-0
taggit/managers.py
+3
-9
taggit/models.py
+0
-0
taggit/tests/models.py
+0
-0
taggit/tests/tests.py
+1
-1
No files found.
taggit/forms.py
View file @
543471cd
taggit/managers.py
View file @
543471cd
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.related
import
ManyToManyRel
from
django.db.models.fields.related
import
ManyToManyRel
,
RelatedField
from
django.db.models.related
import
RelatedObject
from
django.db.models.related
import
RelatedObject
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
taggit.forms
import
TagField
from
taggit.forms
import
TagField
from
taggit.models
import
Tag
,
Tag
gedItem
,
GenericTaggedItemBase
from
taggit.models
import
TaggedItem
,
GenericTaggedItemBase
from
taggit.utils
import
require_instance_manager
from
taggit.utils
import
require_instance_manager
...
@@ -35,7 +35,7 @@ class TaggableRel(ManyToManyRel):
...
@@ -35,7 +35,7 @@ class TaggableRel(ManyToManyRel):
self
.
through
=
None
self
.
through
=
None
class
TaggableManager
(
object
):
class
TaggableManager
(
RelatedField
):
def
__init__
(
self
,
verbose_name
=
_
(
"Tags"
),
through
=
None
):
def
__init__
(
self
,
verbose_name
=
_
(
"Tags"
),
through
=
None
):
self
.
use_gfk
=
through
is
None
or
issubclass
(
through
,
GenericTaggedItemBase
)
self
.
use_gfk
=
through
is
None
or
issubclass
(
through
,
GenericTaggedItemBase
)
self
.
through
=
through
or
TaggedItem
self
.
through
=
through
or
TaggedItem
...
@@ -72,12 +72,6 @@ class TaggableManager(object):
...
@@ -72,12 +72,6 @@ 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_prep_lookup
(
self
,
lookup_type
,
value
):
return
models
.
Field
()
.
get_prep_lookup
(
lookup_type
,
value
)
def
get_db_prep_lookup
(
self
,
*
args
,
**
kwargs
):
return
models
.
Field
()
.
get_db_prep_lookup
(
*
args
,
**
kwargs
)
def
formfield
(
self
,
form_class
=
TagField
,
**
kwargs
):
def
formfield
(
self
,
form_class
=
TagField
,
**
kwargs
):
defaults
=
{
defaults
=
{
"label"
:
_
(
"Tags"
),
"label"
:
_
(
"Tags"
),
...
...
taggit/models.py
View file @
543471cd
taggit/tests/models.py
View file @
543471cd
taggit/tests/tests.py
View file @
543471cd
...
@@ -146,7 +146,7 @@ class TaggableManagerTestCase(BaseTaggingTestCase):
...
@@ -146,7 +146,7 @@ class TaggableManagerTestCase(BaseTaggingTestCase):
)
)
tag
=
self
.
tag_model
.
objects
.
get
(
name
=
"woof"
)
tag
=
self
.
tag_model
.
objects
.
get
(
name
=
"woof"
)
self
.
assertEqual
(
list
(
self
.
pet_model
.
objects
.
filter
(
tags__
name__
in
=
[
tag
])),
[
dog
])
self
.
assertEqual
(
list
(
self
.
pet_model
.
objects
.
filter
(
tags__in
=
[
tag
])),
[
dog
])
cat
=
self
.
housepet_model
.
objects
.
create
(
name
=
"cat"
,
trained
=
True
)
cat
=
self
.
housepet_model
.
objects
.
create
(
name
=
"cat"
,
trained
=
True
)
cat
.
tags
.
add
(
"fuzzy"
)
cat
.
tags
.
add
(
"fuzzy"
)
...
...
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