Skip to content

Commit

Permalink
Merge branch '0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Oordt committed Aug 25, 2011
2 parents 919769d + c45d619 commit f3257f1
Show file tree
Hide file tree
Showing 69 changed files with 4,021 additions and 1,567 deletions.
4 changes: 3 additions & 1 deletion MANIFEST.in
Expand Up @@ -9,4 +9,6 @@ recursive-include docs *.html *.css *.js *.png *.gif

recursive-include supertagging *.py
recursive-include supertagging/sql/ *.sql
recursive-include supertagging/templates/ *.html
recursive-include supertagging/templates/ *.html

prune example
2 changes: 1 addition & 1 deletion doc_src/Makefile
Expand Up @@ -2,7 +2,7 @@
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXOPTS = -a
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
Expand Down
Binary file modified doc_src/_build/doctrees/api.doctree
Binary file not shown.
Binary file removed doc_src/_build/doctrees/differences.doctree
Binary file not shown.
Binary file removed doc_src/_build/doctrees/djangotagging.doctree
Binary file not shown.
Binary file modified doc_src/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified doc_src/_build/doctrees/getting_started.doctree
Binary file not shown.
Binary file modified doc_src/_build/doctrees/index.doctree
Binary file not shown.
Binary file modified doc_src/_build/doctrees/installation.doctree
Binary file not shown.
Binary file modified doc_src/_build/doctrees/markup.doctree
Binary file not shown.
Binary file modified doc_src/_build/doctrees/real_world_example.doctree
Binary file not shown.
Binary file modified doc_src/_build/doctrees/reference/index.doctree
Binary file not shown.
Binary file modified doc_src/_build/doctrees/reference/settings.doctree
Binary file not shown.
Binary file modified doc_src/_build/doctrees/reference/template_tags.doctree
Binary file not shown.
117 changes: 86 additions & 31 deletions doc_src/getting_started.rst
Expand Up @@ -5,61 +5,116 @@ Getting Started

If you have not installed SuperTagging yet, go to the :ref:`installation` page.

Create basic settings
*********************

In your ``settings.py`` file:

.. code-block:: python
SUPERTAGGING_SETTINGS = {
'ENABLED': True,
'DEBUG': True,
}
Setting up OpenCalais API
*************************

Go to `OpenCalais <http://www.opencalais.com/>`_'s website and register for
an api key, and in your settings.py file::
an api key, and in your ``settings.py`` file, alter ``SUPERTAGGING_SETTINGS``\ :

SUPERTAGGING_CALAIS_API_KEY = "YOUR API KEY"
.. code-block:: python
SUPERTAGGING_SETTINGS = {
'ENABLED': True,
'DEBUG': True,
'OPEN_CALAIS': {
'API_KEY': 'YOUR_API_KEY',
}
}
Setting up models to be tagged
******************************

You will need to decide which models and which fields in those models you
will want SuperTagging to mark for tagging.
will want SuperTagging to mark for tagging:

.. code-block:: python
SUPERTAGGING_MODULES = {
'stories.story':
{'fields':[
{'name': 'body'},
],
},
}
SUPERTAGGING_SETTINGS = {
'ENABLED': True,
'DEBUG': True,
'OPEN_CALAIS': {
'API_KEY': 'YOUR_API_KEY',
},
'WATCHED_FIELDS': {
'stories.story': {
'fields':[
{'name': 'body'},
],
},
},
}
The code above tells SuperTagging to tag the **body** field of model
**stories.story**. We can specify any number of fields and models as well.

.. code-block:: python
SUPERTAGGING_MODULES = {
'stories.story':
{'fields':[
{'name': 'body'},
{'name': 'tease'},
{'name': 'kicker'},
],
},
'media.image':
{'fields':[
{'name': 'caption'},
{'name': 'description'},
],
}
}
View :ref:`setting_modules` for more information.

SUPERTAGGING_SETTINGS = {
'ENABLED': True,
'DEBUG': True,
'OPEN_CALAIS': {
'API_KEY': 'YOUR_API_KEY',
},
'WATCHED_FIELDS': {
'stories.story': {
'fields':[
{'name': 'body'},
{'name': 'tease'},
{'name': 'kicker'},
],
},
'media.image': {
'fields':[
{'name': 'caption'},
{'name': 'description'},
],
}
},
}
View :ref:`setting_modules` for more information.

Set up automatic processing
***************************

Finally, add:

.. code-block:: python
SUPERTAGGING_AUTO_PROCESS = True
SUPERTAGGING_SETTINGS = {
'ENABLED': True,
'DEBUG': True,
'OPEN_CALAIS': {
'API_KEY': 'YOUR_API_KEY',
},
'WATCHED_FIELDS': {
'stories.story': {
'fields':[
{'name': 'body'},
],
},
},
'AUTO_PROCESS': True,
}
Post save and post delete signals will be connected to the models
specified in `SUPERTAGGING_MODULES`. Visit :ref:`reference_settings` to
specified in `WATCHED_FIELDS`. Visit :ref:`reference_settings` to
view more details about the SuperTagging settings

View the complete list of :ref:`reference_settings`
Expand Down
10 changes: 6 additions & 4 deletions doc_src/installation.rst
Expand Up @@ -8,10 +8,12 @@ Download SuperTagging

There are a couple ways for you to get Django-SuperTagging,

1. Clone the git repository `from here <http://opensource.washingtontimes.com/projects/supertagging/>`_
2. Download the latest build from our opensource site `here <http://opensource.washingtontimes.com/pypi/simple/supertagging/>`_
3. Use PIP to install from our opensource site pypi
* pip install --extra-index-url=http://opensource.washingtontimes.com/pypi/simple/ supertagging
1. Clone the git repository `from GitHub <https://github.com/callowayproject/django-supertagging>`_
2. Use pip to install it from `PyPI <http://pypi.python.org/pypi/supertagging>`_

::

pip install supertagging


Dependencies
Expand Down
69 changes: 40 additions & 29 deletions doc_src/markup.rst
Expand Up @@ -14,33 +14,48 @@ In the settings you will need to have

.. code-block:: python
SUPERTAGGING_MARKUP = True
SUPERTAGGING_SETTINGS = {
# ... Other settings
'MARKUP': {
'ENABLED': True,
}
}
How It Works
************

When SuperTagging loads up and markup is enabled, it will add an additional
attribute for every field specified in :ref:`setting_modules`.
attribute for every field specified in :ref:`setting_modules`\ .

.. code-block:: python
SUPERTAGGING_SETTINGS = {
'ENABLED': True,
'WATCHED_FIELDS': {
'stories.story':
{'fields':[
{'name': 'body',
'markup_handler': 'MyCustomHandler'}]},
'media.image':
{'fields':[
{'name': 'caption'}]},
'blog.entry':
{'fields':[
{'name': 'content'},
{'name': 'tease',
'markup': False}]}
},
# ... Other settings
'MARKUP': {
'ENABLED': True,
'FIELD_SUFFIX': "tagged",
},
}
SUPERTAGGING_MARKUP = True
MARKUP_FIELD_SUFFIX = "tagged"
SUPERTAGGING_MODULES = {
'stories.story':
{'fields':[
{'name': 'body',
'markup_handler': 'MyCustomHandler'}]},
'media.image':
{'fields':[
{'name': 'caption'}]},
'blog.entry':
{'fields':[
{'name': 'content'},
{'name': 'tease',
'markup': False}]}
}
Lets take the code sample above as an example. We notice that markup is
enabled and the prefix for the markup fields is `tagged`. The first module
Expand All @@ -53,14 +68,11 @@ tagging, **content** and **tease**, but tease is not to be marked up.
After `SuperTagging` is done loading you will end up with three additional
attributes for the three different models.

* **story model**
* tagged_body
* **image model**
* tagged_caption
* **entry**
* tagged_content

Notice that the a 'tagged_tease' does not exist for the **entry** model.
* **Story model:** ``body__tagged``
* **Image model:** ``caption__tagged``
* **Entry model:** ``content__tagged``

Notice that the a ``tease__tagged`` does not exist for the **Entry** model because the markup flag for that field is ``False``\ .

Markup handler
**************
Expand All @@ -81,10 +93,9 @@ You can create your own custom handler as well.
# DO YOUR CUSTOM MARKUP HERE
return "MARKED UP CONTENT"
The `handle` method needs to return a string of the marked up content.
The ``handle`` method needs to return a string of the marked up content.

If you want a create a custom handler but use the default markup method, your code
might look something like this:
If you want a create a custom handler but use the default markup method, your code might look something like this:

.. code-block:: python
Expand Down

0 comments on commit f3257f1

Please sign in to comment.