This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

The small frameworks that helps to write reusable django apps with generic relations

Project Description

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

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:

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:

>>> 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:

>>> 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.7

  • Update django head version

0.3.6

  • Update django head version

0.3.5

  • Add CHANGELOG.rst into manifest

0.3.4

  • Remove deprecation warning

0.3.3

  • Moved the ct shortcut into utils module

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).
Release History

Release History

This version
History Node

0.3.7

History Node

0.3.6

History Node

0.3.5

History Node

0.3.4

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.2

History Node

0.2.1

History Node

0.2

History Node

0.1.1

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_generic_helpers-0.3.7-py2.py3-none-any.whl (9.8 kB) Copy SHA256 Checksum SHA256 3.4 Wheel May 23, 2015
django-generic-helpers-0.3.7.tar.bz2 (5.9 kB) Copy SHA256 Checksum SHA256 Source May 23, 2015
django-generic-helpers-0.3.7.tar.gz (5.8 kB) Copy SHA256 Checksum SHA256 Source May 23, 2015
django-generic-helpers-0.3.7.zip (13.2 kB) Copy SHA256 Checksum SHA256 Source May 23, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting