Skip to main content

DrfXios

DrfXios simplifies communication between frontend and Django Rest Framework API.

Quick start

>>> pip install django-drfxios

settings.INSTALLED_APPS

INSTALLED_APPS = [
    ...
    'drfxios',
    ...
]

settings.py

DRFXIOS_ROUTER_PATH = "<dotted.path.to.router>" # eg "api.urls.router"

context_processors

TEMPLATES = [
    {
        ...
        'OPTIONS': {
            'context_processors': [
                ...
                'drfxios.context_processors.drfxios',
                ...
            ],
        },
    },
]

base.html

<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.2/axios.js"></script>
<script src="https://cdn.jsdelivr.net/npm/url-join@4.0.1/lib/url-join.min.js"></script>
<script src="{% static "drfxios/drfxios.js" %}"></script>

<script>
    dx = new DrfXios('api', {{ DRFXIOS.MODEL_LIST|safe }})
</script>

And you’re ready tu use DrfXios in your templates.

Example:

dx.getModel(<pk>)
dx.createModel(<data:obj>)
dx.deleteModel(<pk>)
dx.getModelList(<filter:obj>)
dx.updateModel(<data:obj>)
dx.patchModel(<data:obj>)

All methods return JavaScript promises so you can use .then, .catch and .finally methods.

Metadata

Release files for django-drfxios 0.2

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

Source distribution (sdist)

Source distribution for django-drfxios 0.2
File Size Uploaded Provenance Actions
django-drfxios-0.2.tar.gz 3.7 kB Without provenance Details for django-drfxios-0.2.tar.gz

Release files / django-drfxios-0.2.tar.gz

Download URL django-drfxios-0.2.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
35c89a8814b22dc85968b715ed0c1749b0a70465be194d69040940898df15266
BLAKE2b-256 checksum
How to use checksums
566ee3d5245b667bd336793769224d0807e833b5273e9f4821f9b31a573d1a28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Security for django-drfxios 0.2

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.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

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