<commit_before>Backwards incompatible changes made in version 0.2.2
====================================================

**COMBINE_STRING** is now used to build the template list when using 
``PositionContent.render`` or ``render_content`` template tag.

Before:

/positions/my_position/<app>__<model>.html

New:

/positions/my_position/<app> **<combine_string>** <model>.html


Installation
============

Using PIP::

	pip install django-kamasutra
	
or download the app `here <http://pypi.python.org/pypi/django-kamasutra/>`_ ::

	python setup.py install


Add **positions** to your settings **INSTALLED_APPS**::

    INSTALLED_APPS = (
        ...
        'positions',
        ...
    )
    
Run syncdb::

    >>> ./manage.py syncdb


Getting Started
===============

Creating your first position
----------------------------

The minimum required arguments to create a positions is a `name`, which is a `SlugField`.

::

    from positions.models import Position
    
    position = Position.objects.create(name="MyPosition")
    
    
Add something to your Position
------------------------------

The position manager has a `add_object` method that takes, at minimum, 2 arguments, `position` and `obj`

* **position** should be a `positions.Position` instance
* **obj** can be any model instance

::
    
    from myapp.models import MyApp
    
    obj = MyApp.objects.get_latest()

    Position.objects.add_object(position=position, obj=obj)
    
    
.. note::

    The `Position` model can define which types of objects that can be added. 
    Therefore when adding objects to a position, make sure the content types 
    is allowed by the `Position` instance.
    
Retrieve your position content
------------------------------

The position manager has a `get_content` method that takes at least 1 argument, `position`.

* **position** should be a `positions.Position` instance

::

    position = Position.objects.get(name="MyPosition")
    
    content = Position.objects.get_content(position=position)
    
    
Retrieve your position content via templatetag
----------------------------------------------

::

    {% get_position_content position as content %}
    
`get_position_content` expects [position] [as] [varname]

* **position** can be a positions.Position instance or a name of a position


::
    
    Position {{ position }} has the following content:<br/>
    <ul>
    {% for obj in content %}
        <li>{{ obj }}</li>
    {% endfor %}
    </ul>
    
.. note::

    By default the object instance will be returned, although returning the positions.PositionContent instance, which holds the generic relation between position and the object, is also possible
    
    ::
    
        {% get_position_content position as content as_content_type=False %}
        <commit_msg>added documentation that alerts users to add the urls<commit_after>Backwards incompatible changes made in version 0.2.2
====================================================

**COMBINE_STRING** is now used to build the template list when using 
``PositionContent.render`` or ``render_content`` template tag.

Before:

/positions/my_position/<app>__<model>.html

New:

/positions/my_position/<app> **<combine_string>** <model>.html


Installation
============

Using PIP::

	pip install django-kamasutra
	
or download the app `here <http://pypi.python.org/pypi/django-kamasutra/>`_ ::

	python setup.py install


Add **positions** to your settings **INSTALLED_APPS**::

    INSTALLED_APPS = (
        ...
        'positions',
        ...
    )
    
Add **positions** to your URLS::

    import positions.urls

    urlpatterns += patterns('',
        url(r'^positions/', include(positions.urls)),
    )

Run syncdb::

    >>> ./manage.py syncdb


Getting Started
===============

Creating your first position
----------------------------

The minimum required arguments to create a positions is a `name`, which is a `SlugField`.

::

    from positions.models import Position
    
    position = Position.objects.create(name="MyPosition")
    
    
Add something to your Position
------------------------------

The position manager has a `add_object` method that takes, at minimum, 2 arguments, `position` and `obj`

* **position** should be a `positions.Position` instance
* **obj** can be any model instance

::
    
    from myapp.models import MyApp
    
    obj = MyApp.objects.get_latest()

    Position.objects.add_object(position=position, obj=obj)
    
    
.. note::

    The `Position` model can define which types of objects that can be added. 
    Therefore when adding objects to a position, make sure the content types 
    is allowed by the `Position` instance.
    
Retrieve your position content
------------------------------

The position manager has a `get_content` method that takes at least 1 argument, `position`.

* **position** should be a `positions.Position` instance

::

    position = Position.objects.get(name="MyPosition")
    
    content = Position.objects.get_content(position=position)
    
    
Retrieve your position content via templatetag
----------------------------------------------

::

    {% get_position_content position as content %}
    
`get_position_content` expects [position] [as] [varname]

* **position** can be a positions.Position instance or a name of a position


::
    
    Position {{ position }} has the following content:<br/>
    <ul>
    {% for obj in content %}
        <li>{{ obj }}</li>
    {% endfor %}
    </ul>
    
.. note::

    By default the object instance will be returned, although returning the positions.PositionContent instance, which holds the generic relation between position and the object, is also possible
    
    ::
    
        {% get_position_content position as content as_content_type=False %}
        
{'fraction_non_alphanumeric': 0.16545893719806765, 'fraction_numerical': 0.001725327812284334, 'mean_word_length': 2.744832041343669, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6660765', 'n_tokens_mistral': 1623, 'n_tokens_neox': 1524, 'n_words': 537}