Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install django-generic-helpers

How to install django-generic-helpers

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install django-generic-helpers
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.2.1
0.2.2Never BuiltWhy not?
0.2.1 Available View build log
0.2 Available View build log
0.1.1 Available View build log
0.1 Available View build log
Windows (64-bit)
0.2.1
0.2.2Never BuiltWhy not?
0.2.1 Available View build log
0.2 Available View build log
0.1.1 Available View build log
0.1 Available View build log
Mac OS X (10.5+)
0.2.1
0.2.2Never BuiltWhy not?
0.2.1 Available View build log
0.2 Available View build log
0.1.1 Available View build log
0.1 Available View build log
Linux (32-bit)
0.2.1
0.2.2Never BuiltWhy not?
0.2.1 Available View build log
0.2 Available View build log
0.1.1 Available View build log
0.1 Available View build log
Linux (64-bit)
0.2.2 Available View build log
0.2.1 Available View build log
0.2 Available View build log
0.1.1 Available View build log
0.1 Available View build log
 
License
MIT license
Dependencies
Lastest release
version 0.2.2 on Jan 9th, 2014

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 app 'generic_helpers' to 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!

Subscribe to package updates

Last updated Jan 9th, 2014

Download Stats

Last month:4

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.