A collection of Django 1.5+ and Django Rest Framework 3.0+ utilities
installation
You can use pip to install the package:
$ pip install djenerics
Then add it to the list of installed apps:
INSTALLED_APPS = (
'djenerics'
)
model mixins
The following mixins are available for your model classes:
- Timestampable
Provides created_at and updated_at fields.
- Ownerable
Provides a owner field which references settings.AUTH_USER_MODEL
view mixins
The following mixins are available for your view classes:
- SelectRelatable
Provides a class variable select_related that allows you to provide a tuple or list of related models to perform a select_related on.
django-rest-framework filter backend
A custom filter backend that provides a generic filter query string parameter.
Convert a search query into a dictionary.
A search query like this one:
party: stakker is akker category:"hiha hoi"
Will be converted to a python dict:
{
'category': 'hiha hoi',
'party': None,
'search': 'stakker is akker'
}
It uses a regular expression to split every token on the : separator instead of using the string.split() function. This is important to distinguish between the following use cases:
- 'party:' => {'party': None}
- 'party:tester' => {'party': 'tester'}
- 'party: tester' => {'search': 'party: tester'}
django-rest-framework serializer mixins
The following mixins are available for your serializer classes:
- Projectable
Gives your api consumers the ability to control what fields are included in the api response using a configurable query string parameter (defaults to _fields).
E.g. a GET /resources?_fields=name,description,count will only return the specified 3 fields of the resource.
- Ownerable
Limit the related field options to only those records owned by the current logged in user.
Metadata
Release files for djenerics 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| djenerics-1.2.0.tar.gz | 5.2 kB | Without provenance | Details for djenerics-1.2.0.tar.gz |
Release files / djenerics-1.2.0.tar.gz
| Download URL | djenerics-1.2.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
665b3bb2d849f93094e562d94e4ebed4178319a5be8e546838da92da73e1a38e
|
|
BLAKE2b-256 checksum How to use checksums |
027c437a6fc2271abb0929cfdeaa72fc8ab7b4897c8e6729d3f38ae61804fddc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for djenerics 1.2.0
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.