Serious Django: Graphene
https://github.com/serioeseGmbH/serious-django-graphene
serious-django-graphene offers a couple of extensions for Graphene development in Django.
get_user_from_info returns the request’s user from the passed info object.
We use this function all the time, for example, to do permission checks on the current user.
FormMutation is based on FailableMutation (see below).
It defines a Graphene mutation based on a plain old Django form. What is this good for? Well, we want to employ the builtin capabilities of Django for input validation and conversion. Why reinvent the wheel to do checks like “string of max length 50” inside Graphene mutations when Forms can do that for you, and have extensible validators?
This is essentially a cleaned up and changed version of the FormMutation delivered with graphene-django itself. The difference is mainly in how we model the returned data in an expectable pattern, see FailableMutation.
FailableMutation defines a mutation that contains:
A success boolean flag
An error value, present only if an error occurred, which is (a union of) either
A list of ValidationError in the format like Django returns for validation errors, or
An ExecutionError, which just contains an error_message String.
If you need additional fields, add them by inheriting from FailableMutation.
make_failable_objecttype turns an existing graphene.ObjectType into a Field that contains:
A result field which is an optional value of the original type
A error field which is an optional String value, present only if an error occurred
A success boolean flag field. Strictly seen, this is superfluous, as the null-ness of result or error can be checked. However, its existence improves semantics on the client, as they can now just check if(result.success) { ... }.
Quick start
Install the package with pip:
pip install serious-django-graphene
Add “serious_django_graphene” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'serious_django_graphene', ]Import and use serious_django_graphene wherever you need the Graphene extensions
Import and use serious_django_graphene.testing wherever you need the Graphene test extensions
Metadata
Release files for serious-django-graphene 0.5.1
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 |
|---|---|---|---|---|
| serious-django-graphene-0.5.1.tar.gz | 7.3 kB | Without provenance | Details for serious-django-graphene-0.5.1.tar.gz |
Release files / serious-django-graphene-0.5.1.tar.gz
| Download URL | serious-django-graphene-0.5.1.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5c32cb32524f46d16500c16d2870bd4ba551995f65a25e0e7e0eb508e8c2b3e
|
|
BLAKE2b-256 checksum How to use checksums |
cf447eed64897cffe1ff0a01ae0d43979ef6d4411935d6aee7bab52fd544bd23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/3.6.7
|
Security for serious-django-graphene 0.5.1
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.