Skip to main content

django-admin-json-view

A simple Django admin mixin that adds a "View as JSON" button to any model's change form. Click it to open a modal with the record's data as formatted JSON — ready to copy.


Installation

pip install django-admin-json-view

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "admin_json_view",
]

Include the URLs in your urls.py:

from django.urls import path, include

urlpatterns = [
    path("admin/", admin.site.urls),
    path("admin-json-view/", include("admin_json_view.urls")),
]

Usage

Add JsonViewMixin to any ModelAdmin:

from admin_json_view.mixins import JsonViewMixin
from django.contrib import admin
from .models import Student

@admin.register(Student)
class StudentAdmin(JsonViewMixin, admin.ModelAdmin):
    pass

That's it. A "{ } View as JSON" button will appear in the top-right of the change form.


Configuration

Option Default Description
json_depth 0 How deep to serialize relations. 0 = direct fields only, 1 = one level of related objects
json_exclude_fields [] List of field names to exclude from the output
@admin.register(Student)
class StudentAdmin(JsonViewMixin, admin.ModelAdmin):
    json_depth = 1
    json_exclude_fields = ["password", "token"]

License

MIT

Release files for django-admin-json-view 0.1.0

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-admin-json-view 0.1.0
File Size Uploaded
django_admin_json_view-0.1.0.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-admin-json-view 0.1.0
File Interpreter ABI Platform
django_admin_json_view-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / django_admin_json_view-0.1.0.tar.gz

Download URL django_admin_json_view-0.1.0.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e0bf2d281f7414e19ef5d88dcaa5ae0c56768e4d284348f0b6edb65dee85ad1d
BLAKE2b-256 checksum
How to use checksums
0c2eec1488087140c9c68aba0c167da78f2cf75c018fefc8997e0175a31e3fa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / django_admin_json_view-0.1.0-py3-none-any.whl

Download URL django_admin_json_view-0.1.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d478904aa575b0f97e0c328e6c4c72cd1c1b186897508f488fde7f5f8c72d83
BLAKE2b-256 checksum
How to use checksums
5fce08e3ab13a21c3a704523b901d5901625988a28a633971e9627cfa8ec94be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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