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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
c299303a
authored
May 03, 2010
by
Carl Meyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc tweaks
parent
0e3f6b7d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
21 deletions
+29
-21
AUTHORS.txt
+2
-2
docs/api.txt
+12
-2
docs/custom_through.txt
+12
-12
docs/getting_started.txt
+3
-5
No files found.
AUTHORS.txt
View file @
c299303a
django-taggit was original created by Alex Gaynor.
django-taggit was original
ly
created by Alex Gaynor.
The following is a list of much appreciated contributors:
The following is a list of much appreciated contributors:
...
@@ -7,5 +7,5 @@ fakeempire <adam@fakeempire.com>
...
@@ -7,5 +7,5 @@ fakeempire <adam@fakeempire.com>
Ben Firshman <ben@firshman.co.uk>
Ben Firshman <ben@firshman.co.uk>
Alex Gaynor <alex.gaynor@gmail.com>
Alex Gaynor <alex.gaynor@gmail.com>
Rob Hudson <rob@cogit8.org>
Rob Hudson <rob@cogit8.org>
Carl Meyer
Carl Meyer
<carl@oddbird.net>
Frank Wiles
Frank Wiles
docs/api.txt
View file @
c299303a
...
@@ -8,7 +8,7 @@ playing around with the API.
...
@@ -8,7 +8,7 @@ playing around with the API.
add(*tags)
add(*tags)
~~~~~~~~~~
~~~~~~~~~~
This adds tags to an object
, t
he tags can be either ``Tag`` instances, or
This adds tags to an object
. T
he tags can be either ``Tag`` instances, or
strings::
strings::
>>> apple.tags.all()
>>> apple.tags.all()
...
@@ -19,7 +19,7 @@ strings::
...
@@ -19,7 +19,7 @@ strings::
remove(*tags)
remove(*tags)
~~~~~~~~~~~~~
~~~~~~~~~~~~~
Removes a tag from an object
, n
o exception is raised if the object doesn't have
Removes a tag from an object
. N
o exception is raised if the object doesn't have
that tag.
that tag.
clear()
clear()
...
@@ -40,4 +40,14 @@ appear, available as the ``num_times`` attribute on each tag. The ``QuerySet``
...
@@ -40,4 +40,14 @@ appear, available as the ``num_times`` attribute on each tag. The ``QuerySet``
is ordered by ``num_times``, descending. The ``QuerySet`` is lazily evaluated,
is ordered by ``num_times``, descending. The ``QuerySet`` is lazily evaluated,
and can be sliced efficiently.
and can be sliced efficiently.
similar_objects()
~~~~~~~~~~~~~~~~~
Returns a list (not a lazy ``QuerySet``) of other objects tagged similarly to
this one, ordered with most similar first. Each object in the list is decorated
with a ``similar_tags`` attribute, the number of tags it shares with this
object.
If using generic tagging (the default), this method searches all tagged
objects. If querying on a model with its own tagging through table, only other
instances of the same model will be returned.
docs/custom_through.txt
View file @
c299303a
Using a Custom Through Model
Using a Custom Through Model
============================
============================
By default ``django-taggit`` uses a "through model" with a ``GenericForeignKey``
By default ``django-taggit`` uses a "through model" with a
on it. However, there are some cases where this isn't desirable, for example
``GenericForeignKey`` on it. However, there are some cases where this
if you want the speed and referential guarntees of a real ``ForeignKey``, or if
isn't desirable, for example if you want the speed and referential
you have a model with a non-integer primary key. In these cases ``django-taggit``
guarantees of a real ``ForeignKey``, or if you have a model with a
makes it easy to subsistute your own through model.
non-integer primary key. In these cases ``django-taggit`` makes it
easy to substitute your own through model.
You must create your own intermediary model, a subclass of
``taggit.models.TaggedItemBase`` with a foreign key to your content model named
Youe intermediary model must be a subclass of
``content_object``, and then pass this intermediary model as the ``through``
``taggit.models.TaggedItemBase`` with a foreign key to your content
argument of ``TaggableManager``::
model named ``content_object``. Pass this intermediary model as the
``through`` argument to ``TaggableManager``::
from django.db import models
from django.db import models
...
@@ -27,5 +28,4 @@ argument of ``TaggableManager``::
...
@@ -27,5 +28,4 @@ argument of ``TaggableManager``::
tags = TaggableManager(through=TaggedFood)
tags = TaggableManager(through=TaggedFood)
Once this is done, the API works identically with direct-tagged or
Once this is done, the API works the same as for GFK-tagged models.
GFK-tagged models.
docs/getting_started.txt
View file @
c299303a
Getting Started
Getting Started
===============
===============
To get started using ``django-taggit`` simply install it ``pip``::
To get started using ``django-taggit`` simply install it with
``pip``::
$ pip install django-taggit
$ pip install django-taggit
Add
it
to your project's ``INSTALLED_APPS`` setting.
Add
``"taggit"``
to your project's ``INSTALLED_APPS`` setting.
And then to any model you want tagging on do the following::
And then to any model you want tagging on do the following::
...
@@ -18,6 +19,3 @@ And then to any model you want tagging on do the following::
...
@@ -18,6 +19,3 @@ And then to any model you want tagging on do the following::
# ... fields here
# ... fields here
tags = TaggableManager()
tags = TaggableManager()
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