django-lazydrf
django-lazydrf is a dirty magic applied to your models to generate automated Django Rest Framework endpoints.
Note that this is an experimental project. Use at your own risk and sadness.
TODO: Provide a complete README
Installation
pip install django-lazydrf
Usage
Define a Django model as follows:
from django.db import models from django.db.models import CharField from lazydrf.models import LDRF class Record(models.Model, metaclass=LDRF): """ Defines a key/value record model. """ #: Defines the key of the record. key = CharField(max_length=16, unique=True, blank=False, null=False) #: Defines the value of the record. value = CharField(max_length=64, blank=False, null=False, db_index=True) class Meta: """ Defines Django model metadata. """ app_label = "sample" class APIFields: """ Defines fields related API metadata. """ editable = ["key", "value"] ordering = ["key"] searching = ["key", "^value"] class APIFiltering: """ Defines filtering related API metadata. """ key = ["exact", "icontains", "startswith"] value = ["exact", "icontains", "startswith"] class APIViewset: pass #readonly = TrueRegister all lazydrf models for a given Django application to the usual DRF router, like:
from django.conf.urls import url, include from django.contrib import admin from rest_framework import routers from lazydrf.utils import register_app #: Defines the DRF router. Router = routers.DefaultRouter() ## Register model endpoints for the sample Django application: register_app("sample", Router) #: Defines URL patterns: urlpatterns = [ url(r'^admin/', admin.site.urls), url(r"^", include(Router.urls)), ]
Metadata
Release files for django-lazydrf 0.0.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 |
|---|---|---|---|---|
| django-lazydrf-0.0.1.tar.gz | 7.9 kB | Without provenance | Details for django-lazydrf-0.0.1.tar.gz |
Release files / django-lazydrf-0.0.1.tar.gz
| Download URL | django-lazydrf-0.0.1.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d90798f00379a2e5eac051b0454762ac057d334d353a3b7fef038db30371b926
|
|
BLAKE2b-256 checksum How to use checksums |
7b70b652d8c28d2188eb7bbe60d2a4dcbe8548715f49b04ba4b64fb82e7c8a3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-lazydrf 0.0.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.