Skip to main content

Datamodel showing entities and relationships

Project description

apis-datamodel

A reusable Django app that introspects your APIS Core data model and displays a matrix of relations between entity types.

Features

  • Automatically discovers all Relation subclasses defined in your project
  • Renders a subject × object matrix where each cell shows the name and reverse_name of the relation
  • Overridable templates via Django's standard app template loading order
  • Django system checks to catch missing dependencies and misconfigured INSTALLED_APPS / URL includes early

Requirements

  • Python ≥ 3.13
  • Django (any version supported by apis-core-rdf)
  • apis-core-rdf >= 0.62.0

Installation

pip install apis-datamodel

Setup

1. Add to INSTALLED_APPS

apis_datamodel must appear after your project app so project-level template overrides are discovered first:

INSTALLED_APPS = [
    ...
    "apis_core.apis_metainfo",
    "apis_core.relations",
    "apis_core.apis_entities",
    "your_project",   # must come before apis_datamodel
    "apis_datamodel",
]

2. Include the URLs

# urls.py
from django.urls import include, path

urlpatterns = [
    ...
    path("datamodel/", include("apis_datamodel.urls")),
]

The matrix view is then available at /datamodel/.

Template customisation

The package ships with two templates:

Template Purpose
apis_datamodel/base.html Wrapper — provides dm_head and dm_content blocks
apis_datamodel/datamodel.html Renders the relation matrix

To customise the layout, place a file at the same path inside your own app's templates/ directory. Because your app is listed before apis_datamodel in INSTALLED_APPS, Django will pick yours up first.

The package template for datamodel.html extends apis_datamodel/base.html by default, but you can point it at your own base template by passing a parent_template context variable:

# e.g. in a subclassed view
def get_context_data(self, **kwargs):
    ctx = super().get_context_data(**kwargs)
    ctx["parent_template"] = "base.html"
    return ctx

System checks

The app registers three Django system checks that run with manage.py check:

ID What it validates
apis_datamodel.E001 Required APIS Core apps are present in INSTALLED_APPS
apis_datamodel.E002 apis_datamodel.urls is included in the root URLconf
apis_datamodel.E003 apis_datamodel appears after the host project app in INSTALLED_APPS

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

apis_datamodel-0.1.0.tar.gz (42.7 kB view details)

Uploaded Source

Built Distribution

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

apis_datamodel-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: apis_datamodel-0.1.0.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for apis_datamodel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cd9cc764e13ea7b033fb96e0e5c864588be9292cbbd3e543f451589ac2d6767b
MD5 f0bdd59ff081481c0dcc66f7d0c20503
BLAKE2b-256 848613c0db7441f23d53d66dbc165aab052e161c47b62c0263f9a0359c93cd0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for apis_datamodel-0.1.0.tar.gz:

Publisher: publish.yml on gythaogg/apis-datamodel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: apis_datamodel-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for apis_datamodel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e415888f59c5c73a3c6cf1ca60c81c3ed65abd83b3871d4e4118f20f691f02a
MD5 4cac219c1e75eb106d350a85fa1dfd89
BLAKE2b-256 42913a4736bc16b06287101a7c3b32b6a83d8b2a80bf664e240c11a6cb15c17b

See more details on using hashes here.

Provenance

The following attestation bundles were made for apis_datamodel-0.1.0-py3-none-any.whl:

Publisher: publish.yml on gythaogg/apis-datamodel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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