Metadata-Version: 2.0
Name: django-generic-helpers
Version: 0.3.2
Summary: The small frameworks that helps to write reusable django apps with generic relations
Home-page: https://github.com/marazmiki/django-generic-helpers
Author: Mikhail Porokhovnichenko <marazmiki@gmail.com>
Author-email: marazmiki@gmail.com
License: MIT license
Download-URL: https://github.com/marazmiki/django-generic-helpers/archive/master.zip
Platform: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Framework :: Django
Requires-Dist: Django (>=1.5)

======================
django-generic-helpers
======================

.. image:: https://badge.fury.io/py/django-generic-helpers.png
    :target: http://badge.fury.io/py/django-generic-helpers

.. image:: https://travis-ci.org/marazmiki/django-generic-helpers.png?branch=master
        :target: https://travis-ci.org/marazmiki/django-generic-helpers

.. image:: https://coveralls.io/repos/marazmiki/django-generic-helpers/badge.png?branch=master
  :target: https://coveralls.io/r/marazmiki/django-generic-helpers?branch=master

.. image:: https://pypip.in/d/django-generic-helpers/badge.png
        :target: https://pypi.python.org/pypi/django-generic-helpers

.. image:: https://pypip.in/wheel/django-generic-helpers/badge.svg
    :target: https://pypi.python.org/pypi/django-generic-helpers/
    :alt: Wheel Status

.. image:: https://pypip.in/py_versions/django-generic-helpers/badge.png
    :target: https://pypi.python.org/pypi/django-generic-helpers/
    :alt: Supported Python versions


This app provides some snippets (such as abstract models and managers
with some useful methods) to simplyfy creation of another pluggable apps.

The license is MIT.


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

.. code:: bash

    pip install django-generic-helpers

After you can add the `generic_helpers` app into your `INSTALLED_APPS`. If you aren't
want to run test, you can skip this step.

Usage
=====

To use this app, just import GenericRelationModel class from
generic_helpers.models package and inherit your model from it:

.. code:: python

    from django.db import models
    from generic_helpers.models import GenericRelationModel

    class MyModel(GenericRelationModel):
        title = models.CharField(max_length=255)

Now MyModel class has content_object attribute and you can create MyModel
instances using generic relation:

.. code:: python

    >>> from django.contrib.auth.models import User
    >>> user = User.objects.get(pk=1)
    >>>
    >>> my_model = MyModel.objects.create(title='title',
    ...                                   content_object=user)
    >>>

In this example how you can see we have used User.

Also your model manager has a get_for_object method for quick filtering by
content_object complex field:

.. code:: python


    >>> from django.contrib.auth.models import User
    >>> user = User.objects.get(pk=1)
    >>>
    >>> models_for_user = MyModel.objects.get_for_object(user)
    >>>

Contributing
============

If you've found a bug, implemented a feature and think it is useful, or you've
own pluggable app and want to use django-generic-helpers in it, then please
consider contributing. Patches, pull requests or just suggestions are welcome!


0.3.2
-----

* Added CHANGELOG :)
* Added Python 3.4x support;
* Dropped Python 3.2x support;
* Improved code styling with pep8;
* Wheel available;
* Coverage support;
* Updated Django head version;
* Fix 0.3.1 install bug (import six from django).




