Skip to main content

django-generic-helpers

https://badge.fury.io/py/django-generic-helpers.png https://travis-ci.org/marazmiki/django-generic-helpers.png?branch=master https://coveralls.io/repos/marazmiki/django-generic-helpers/badge.png?branch=master https://pypip.in/d/django-generic-helpers/badge.png Wheel Status 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

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

Metadata

Release files for django-generic-helpers 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distributions (sdists)

Source distribution for django-generic-helpers 0.3.4
File Size Uploaded Provenance Actions
django-generic-helpers-0.3.4.zip 12.7 kB Without provenance Details for django-generic-helpers-0.3.4.zip
django-generic-helpers-0.3.4.tar.gz 5.6 kB Without provenance Details for django-generic-helpers-0.3.4.tar.gz
django-generic-helpers-0.3.4.tar.bz2 5.8 kB Without provenance Details for django-generic-helpers-0.3.4.tar.bz2

Built distribution (wheel)

Table of built distributions (wheels) for django-generic-helpers 0.3.4
File Interpreter ABI Platform Actions
django_generic_helpers-0.3.4-py2.py3-none-any.whl Python 2, Python 3 none any Details for django_generic_helpers-0.3.4-py2.py3-none-any.whl

Total release size: 33.7 kB

Release files / django-generic-helpers-0.3.4.zip

Download URL django-generic-helpers-0.3.4.zip
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
81e7931dc424b30367bb651b54d76e4d9d38234d02f2c770168a7a56ce27a54d
BLAKE2b-256 checksum
How to use checksums
2580d8bbfcd22c0101f365fcdd7fef2c594f7e0529bbc06e7a7fc24b3122567c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django-generic-helpers-0.3.4.tar.gz

Download URL django-generic-helpers-0.3.4.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6def4a9a2bf21f1c9743ab48bca4ddce5415c394c37232d8736e41ab226c30b3
BLAKE2b-256 checksum
How to use checksums
fd96ebc828caf3a74751a2efbc49b35d2ae285cfb3f6874f441d542038dde1c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django-generic-helpers-0.3.4.tar.bz2

Download URL django-generic-helpers-0.3.4.tar.bz2
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
789f02f45f0a1d68954113c3c0a4e530d44991a3808797dbc8674464864d71f3
BLAKE2b-256 checksum
How to use checksums
716e7da1b2f5807af3493e2b75f425dd590bcc9c321f54583d96e84a993db3f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_generic_helpers-0.3.4-py2.py3-none-any.whl

Download URL django_generic_helpers-0.3.4-py2.py3-none-any.whl
Size 9.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
744fb7b3fb740d7175cc12d790a65efa1f0b2905d4eab973cd64bf328f5bc8fe
BLAKE2b-256 checksum
How to use checksums
4ea2ff49e9de134279d690f09185fcda871504d00fd6a95edf017126aba2803a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-generic-helpers 0.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page