rn-forge-django
Documentation · Changelog · Source · All pykit packages
Opinionated Django/DRF integration layer built on top of
rn-forge-commons
and
rn-forge-web.
Install
Require the package by version range:
uv add "rn-forge-django[all]>=0.6,<0.7"
Application code imports rn_forge.web directly (wire models, pagination,
problem types, the auth contract), and this package does not re-export it.
Declare rn-forge-web as well, so the import is not an undeclared transitive
dependency:
uv add "rn-forge-web>=0.3,<0.4"
Optional extras:
| Extra | Adds |
|---|---|
drf |
Django REST Framework integration (views, serializers, exceptions, pagination, idempotency, concurrency, casing) |
transfer |
django-import-export + rn-forge-data (tablib, openpyxl), for rn_forge.django.drf.transfer: tabular export and import, batch create and delete |
openapi |
djangorestframework + drf-spectacular, for drf.openapi |
oidc |
djangorestframework + rn-forge-auth[oidc], for auth.drf.oidc JWKS bearer auth |
redis |
rn-forge-auth[redis], the Redis client for Django's Redis cache backend that holds login transactions and revoked session IDs |
celery |
celery, for the celery app factory |
fixtures |
rn-forge-data[pandas], for building Django JSON fixtures from Excel workbooks |
security |
rn-forge-web[security], for rn_forge.django.security |
cors |
django-cors-headers, for rn_forge.django.cors |
otel |
opentelemetry-instrumentation-django, for rn_forge.django.tracing |
all |
Everything above |
What's inside
models— Abstract model base classes:BaseModel(status enum field, audit timestamps, natural-key fixture support viaNaturalKeyLookupManager/FixtureModelMixin, opt-infull_clean()-on-save),DateModel,DateRangeModel,TruncateModelMixin; the opt-inVersionedModelMixin/ImmutableModelMixin; andSequenceGeneratorover an abstract counter.auth— An installable Django app (rn_forge.django.auth, labelrn_forge_django_auth) that bindsrn-forge-authto Django and DRF:routes(the/authURLconf and its configuration),sessions(django.contrib.sessionssessions with timeouts and revocation),csrf(CSRF middleware and settings),stores(login transactions and replay records in Django's cache),rate_limit,audit(audit events),accountsandmodels(the default account resolver and its link and state tables),authorization(the default authorization context provider), andauth.drf(session and bearer authentication, permission-key and resource-policy hooks, serializers and the management viewsets).drf— DRF integration outside the auth app:drf.views(base view classes, mixins,PermissionByMethodMixin),drf.routers(CustomMethodRouter, AIP-136 colon custom methods),drf.transfer(transferextra: tabular export/import, batch create/delete),drf.serializers(base serializer, custom fields),drf.exceptions(the RFC 9457 problem handler and the legacy handler),drf.pagination(AIP-158 cursor pagination),drf.idempotency,drf.concurrency,drf.casing(camelCase renderer/parser) anddrf.openapi(drf-spectacular;openapiextra).tracing(otelextra) —instrument(): OpenTelemetry instrumentation for Django, called once before Django loads.messaging— transactional outbox/inbox: abstract models,make_outbox_relay,process_event(bus and handler registry come fromrn_forge.commons.integration.messaging).celery(celeryextra) —make_appandRETRYABLE_TASK_KWARGS.settings—rn_forge_django_settings: a typed, frozen-dataclass settings facade built from the DjangoRN_FORGE_DJANGOsetting dict, auto-reloaded onoverride_settings/setting_changed.fixtures— Builds Django JSON fixtures from Excel workbooks (requires thefixturesextra).urls/views— Reusable standalone views (including thereadiness_viewfactory anddebug_request) and URLconf;utilscarries therequire_settings/require_environmentstartup guards.
The HTTP wire semantics — problem bodies, preconditions, pagination tokens,
idempotency keys, readiness reports, the auth contract — are rn-forge-web's.
Everything here that touches them is an adapter, and tests/test_conformance.py
drives the shared conformance table through a Django application wired from
them.
Dependencies and package behavior
rn-forge-webis a base dependency: five modules are adapters over it.rn-forge-authis a base dependency:authbinds its login flows, stores,Principal,Requirementand authorization contracts to Django and DRF.drf-spectacular(openapiextra) supplies the OpenAPI schema integration.drf.casingsupplies the camelCase renderer and parser.oidcextra — JWKS verification isrn-forge-auth[oidc](PyJWT);auth.drf.oidconly binds it to DRF.celeryextra — supplies the Celery app factory.- Migrations. The auth app has one, for the external-account link and
account-state tables.
SequenceGenerator's counter is abstract and adds no table.
Minimum example
from django.db import models
from rn_forge.django.models import BaseModel
class Order(BaseModel):
reference = models.CharField(max_length=64, unique=True)
def natural_keys(self) -> list[str]:
return ["reference"]
Errors
Set REST_FRAMEWORK["EXCEPTION_HANDLER"] to
rn_forge.django.drf.exceptions.problem_details_exception_handler to render
every DRF error as RFC 9457 application/problem+json (validation errors under
errors, a request body over DATA_UPLOAD_MAX_MEMORY_SIZE as 413);
drf_exception_handler is the older normalized JSON body.
Configuration
Settings are read from a single RN_FORGE_DJANGO dict in your Django settings
module, e.g.:
RN_FORGE_DJANGO = {
"AUTH": {"PROBLEM_TYPE_BASE": "https://errors.example.com/"},
"DRF": {
"TRANSFER": {"MAX_ROWS": 10_000},
"PAGINATION": {"PAGE_SIZE": 50, "MAX_PAGE_SIZE": 200},
"CASING": {"ENABLED": True},
},
}
To use the bundled auth app, add "rn_forge.django.auth" to INSTALLED_APPS.
Maintainer commands are in the development guide.
Tests configure Django directly in
tests/conftest.py
(sqlite in-memory database) — there is no separate Django settings module.
Test-only models and their tables follow the convention in that file's
docstring.
Metadata
Release files for rn-forge-django 0.7.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 |
|---|---|---|---|---|
| rn_forge_django-0.7.0.tar.gz | 86.2 kB | With provenance | Details for rn_forge_django-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rn_forge_django-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for rn_forge_django-0.7.0-py3-none-any.whl |
Total release size: 197.9 kB
Release files / rn_forge_django-0.7.0.tar.gz
| Download URL | rn_forge_django-0.7.0.tar.gz |
|---|---|
| Size | 86.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b08366c9d1ef7881426f241fda9d6396fec3ebb54980d0a1fe5f957f1f0495b2
|
|
BLAKE2b-256 checksum How to use checksums |
9665a608eeeee0097bfc2ccc30dcacc449c0f25a082e00bbd82a2586cba759a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / rn_forge_django-0.7.0-py3-none-any.whl
| Download URL | rn_forge_django-0.7.0-py3-none-any.whl |
|---|---|
| Size | 111.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de064d44e873c2016aa496157f9af021e8cb3d6d4e1799bda4a91a95f47b3a05
|
|
BLAKE2b-256 checksum How to use checksums |
a2be1ab5b8b4d56647cac912452cf820e4d779a8df02bbf3d9866706d45ec296
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logSecurity for rn-forge-django 0.7.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for rn_forge_django-0.7.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logA 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.