Skip to main content

A Django reusable package to manage Architectural Decision Records.

Project description

django-adr

A Django reusable package to manage Architectural Decision Records (ADR).

Warning: This package is not production ready. APIs and data models may change between versions.

Features

  • Django Admin interface to create and manage ADRs
  • HTML list and detail views with status filtering
  • Read-only REST API (Django REST Framework) with pre-rendered Markdown HTML fields
  • Management command create_adr to create ADRs from the CLI, with optional --supersedes to mark an existing ADR as superseded in one step
  • Management command export_adrs to export all ADRs as Markdown files
  • Markdown support for context, decision, and consequences fields
  • Internationalization (i18n) support — English locale included

Installation

pip install django-adr

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "django_adr",
]

Include the URLs:

from django.urls import include, path

urlpatterns = [
    ...
    path("adrs/", include("django_adr.urls", namespace="django_adr")),
]

Run migrations:

python manage.py migrate

Usage

Admin

Visit /admin/django_adr/adr/ to manage ADRs through the Django admin.

HTML views

  • /adrs/ — list all ADRs
  • /adrs/?status=accepted — filter by status
  • /adrs/<number>/ — view a single ADR

REST API

  • GET /adrs/api/adrs/ — list all ADRs
  • GET /adrs/api/adrs/<number>/ — retrieve a single ADR

Management commands

Create a new ADR:

python manage.py create_adr "Use PostgreSQL" \
    --context="We need a relational database." \
    --decision="Use PostgreSQL." \
    --consequences="Team must know SQL."

Create a new ADR and supersede an existing one in a single step:

python manage.py create_adr "Use CockroachDB" --supersedes=3

This creates the new ADR and automatically marks ADR-0003 as Superseded.

Export all ADRs as Markdown files:

python manage.py export_adrs --output-dir=docs/adr

Each ADR is written to <output-dir>/<number>-<slug>.md.

ADR statuses

Status Description
proposed Under discussion
accepted Agreed and in effect
deprecated No longer relevant
superseded Replaced by a newer ADR
rejected Considered and not adopted

Protecting the views

The HTML views and REST API are public by default. The package does not enforce any authentication strategy — that is left to the host project.

HTML views — in urls.py, wrap the URL include with login_required:

from django.contrib.auth.decorators import login_required
from django.urls import include, path

urlpatterns = [
    path("adrs/", login_required(include("django_adr.urls", namespace="django_adr"))),
]

REST API — set DEFAULT_PERMISSION_CLASSES in settings.py:

REST_FRAMEWORK = {
    "DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.IsAuthenticated"],
}

Or scope it to the ADR router only by subclassing ADRViewSet:

from django_adr.api import ADRViewSet
from rest_framework.permissions import IsAuthenticated

class ProtectedADRViewSet(ADRViewSet):
    permission_classes = [IsAuthenticated]

Translations

All user-facing strings are translatable. The package ships with an English locale. To generate translations for your project:

python manage.py makemessages -l it

Ensure USE_I18N = True in your project settings.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_adr-0.1.0.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_adr-0.1.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file django_adr-0.1.0.tar.gz.

File metadata

  • Download URL: django_adr-0.1.0.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_adr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 085c8e4823aaf1955dd700330c8dbffe221f815e780f76f8bc9c3cf12c7dfacd
MD5 01fc3a2b99f481bb9907e7d527f39a14
BLAKE2b-256 534338ba385c27ca30b400640460d8485cf37b9030b5418e3a2646e2ccb5be1a

See more details on using hashes here.

File details

Details for the file django_adr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_adr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for django_adr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1327f133b053257e17c7d5b5d5335f6b85c605981146dc50647cb416a74086eb
MD5 65b93e2b7812e9bb9924c3007c48a723
BLAKE2b-256 2b18afcded7c633a7f3fcc8f0b251d88b007c6b231883a5bdfafd8f232c0a52b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page