Skip to content

Commit

Permalink
Docs reorganization with a focus in provide a quickstart in README
Browse files Browse the repository at this point in the history
  • Loading branch information
clabra committed Sep 19, 2014
1 parent 85eec36 commit e731e44
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 952 deletions.
73 changes: 63 additions & 10 deletions INSTALL.txt
@@ -1,14 +1,67 @@
Thanks for downloading django-tagging.
Installation
============

To install it, run the following command inside this directory:
Installing an official release
------------------------------

python setup.py install
Official releases are made available from
http://code.google.com/p/django-tagging/

Or if you'd prefer you can simply place the included ``tagging``
directory somewhere on your Python path, or symlink to it from
somewhere on your Python path; this is useful if you're working from a
Subversion checkout.
Remember run the command ``manage.py syncdb`` after installation

Note that this application requires Python 2.3 or later, and Django
0.96 or later. You can obtain Python from http://www.python.org/ and
Django from http://www.djangoproject.com/.
Source distribution
~~~~~~~~~~~~~~~~~~~

Download the .zip distribution file and unpack it. Inside is a script
named ``setup.py``. Enter this command::

python setup.py install

...and the package will install automatically.



Windows installer
~~~~~~~~~~~~~~~~~

A Windows installer is also made available - download the .exe
distribution file and launch it to install the application.

An uninstaller will also be created, accessible through Add/Remove
Programs in your Control Panel.

Installing the development version
----------------------------------

Alternatively, if you'd like to update Django Tagging occasionally to pick
up the latest bug fixes and enhancements before they make it into an
official release, perform a `Subversion`_ checkout instead. The following
command will check the application's development branch out to an
``tagging-trunk`` directory::

svn checkout http://django-tagging.googlecode.com/svn/trunk/ tagging-trunk

Add the resulting folder to your `PYTHONPATH`_ or symlink (`junction`_,
if you're on Windows) the ``tagging`` directory inside it into a
directory which is on your PYTHONPATH, such as your Python
installation's ``site-packages`` directory.

You can verify that the application is available on your PYTHONPATH by
opening a Python interpreter and entering the following commands::

>>> import tagging
>>> tagging.VERSION
(0, 3, 'pre')



Once you've installed Django Tagging and want to use it in your Django
applications, do the following:

1. Put ``'tagging'`` in your ``INSTALLED_APPS`` setting.
2. Run the command ``manage.py syncdb``.

The ``syncdb`` command creates the necessary database tables and
creates permission objects for all installed apps that need them.

That's it!
59 changes: 55 additions & 4 deletions README.txt
Expand Up @@ -4,10 +4,60 @@ Django Tagging NG

This is a enhanced tagging application for Django projects

For installation instructions, see the file "INSTALL.txt" in this
directory; for instructions on how to use this application, and on
what it provides, see the file "overview.txt" in the "docs/"
directory.
- For installation instructions, see the file "INSTALL.txt" in this directory

- For detailed instructions on how to configure and know all possibilities of this application, see the file "OVERVIEW.txt"

Quickstart
----------

1.- Register a model:

from django.db import models
import tagging
from shop.apps.products.models import Widget

class Widget(models.Model):
name = models.CharField(max_length=50)

tagging.register(Widget)

2.- Use it

w = Widget.objects.get(...)

from tagging.models import Tag, TaggedItem
house_tag = Tag.objects.get(name='house')
thing_tag = Tag.objects.get(name='thing')

- Set tags for instance:
w.tags = 'tag1 tag2'

- Get tag for instance:
w.tags
'tag1 tag2'

- Retrive instances with tag1 AND tag2
TaggedItem.objects.get_by_model(Widget, [house_tag, thing_tag])
[<Widget: pk=1>]

- Retrieve filtered instances with 'tag1'
TaggedItem.objects.get_by_model(Widget.objects.filter(price__lt=50), 'house')


- Get all tags for a model:
Widget.tags
'tag1 tag2 tag3 tag4 tag5'

- Get cloud for a model:
Widget.cloud()

- Get tags for a model with usage counts:
Widget.tags.usage(counts=True)

- Get related tags (retrieve tags used by model instances which are also tagged with tag1 and tag2)
Widget.tags.related(['tag1', 'tag2'], counts=True, min_count=3)


Authors
-------
Expand All @@ -19,6 +69,7 @@ Enhanced by:
Alexander Artemenko <svetlyak.40wt@gmail.com>
Antti Kaihola <akaihol+django@ambitone.com>
GW [http://gw.tnode.com/] <gw.2012@tnode.com>
Concha Labra https://github.com/clabra

Sources
-------
Expand Down
3 changes: 3 additions & 0 deletions REQUIREMENTS.txt
@@ -0,0 +1,3 @@
Note that this application requires Python 2.3 or later, and Django
0.96 or later. You can obtain Python from http://www.python.org/ and
Django from http://www.djangoproject.com/.

0 comments on commit e731e44

Please sign in to comment.