Skip to main content

Automatic and customizable admin interface for Django projects.

Project description

🚀 SnapAdmin — Declarative Django Admin & API Package

SnapAdmin is a high-performance, declarative Django package that eliminates admin and API boilerplate. Define your model fields once — get a feature-rich, beautiful Django admin (powered by Unfold), a full REST API, and a dynamic GraphQL API automatically.

Python Django License: MIT


📦 SnapAdmin Package Features

The core snapadmin package provides everything you need to bootstrap your project's admin and API:

Feature Description
Declarative Admin Configure list_display, search_fields, list_filter directly in your models using SnapField.
Beautiful UI Native integration with django-unfold for a modern, responsive admin experience.
Status Badges Easily add color-coded HTML badges for choices and status fields.
Advanced Layout Support for horizontal field rows and tabbed interfaces within the admin form.
Range Filters Built-in date and numeric range filters for efficient data exploration.
Change Logging Automatic tracking of field-level changes (old → new) with a dedicated history view.
Automatic REST API Instantly generated CRUD endpoints for every SnapModel with zero extra code.
Dynamic GraphQL API Automatically generated GraphQL schema with support for complex data fetching.
Token Auth Secure, expirable API tokens with granular model-level access control.
Configurable Easily enable/disable REST API, GraphQL, Swagger docs, and search modes via settings.
Elasticsearch Ready Multi-mode storage (DB_ONLY, DUAL, ES_ONLY) for blazing fast search.
Structured Logging Integrated structlog for readable local logs and JSON logs in production.

🏗 Package Architecture

snapadmin/
├── api/             # REST & GraphQL API core: views, serializers, auth
├── management/      # Custom management commands
├── migrations/      # Core package migrations (e.g., APIToken)
├── static/          # UI assets (CSS, JS, SVG logos)
├── templates/       # Custom admin templates & dashboard
├── fields.py        # SnapField definitions with admin introspection
├── models.py        # SnapModel base, EsManager, and core logic
└── urls.py          # Auto-configurable API and documentation routes

🚀 Quickstart: Installation

From PyPI (Recommended)

pip install django-snapadmin

From GitHub (Latest/Development)

pip install git+https://github.com/drofji/django-snapadmin.git

🛠 Usage & Configuration

1. Configure Settings

Add required apps to INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    "unfold",
    "snapadmin",
    "rest_framework",
    "drf_spectacular",
    "graphene_django",
    # ...
]

2. Define your Model

from snapadmin import fields as snap, models as snap_models

class Product(snap_models.SnapModel):
    name = snap.SnapCharField(max_length=200, searchable=True, show_in_list=True)
    # Group fields into a single horizontal row
    price = snap.SnapDecimalField(max_digits=10, decimal_places=2, row="pricing")
    available = snap.SnapBooleanField(default=True, row="pricing")

3. Register Admin

# admin.py
from snapadmin.models import SnapModel
SnapModel.register_all_admins()

⚙️ Advanced Settings

Control core features via Django settings:

SNAPADMIN_REST_API_ENABLED = True   # Enable/Disable the REST API
SNAPADMIN_GRAPHQL_ENABLED = True    # Enable/Disable the GraphQL API
SNAPADMIN_SWAGGER_ENABLED = True    # Enable/Disable Swagger UI documentation
ELASTICSEARCH_ENABLED = False       # Toggle ES search engine support

🌟 Demo Application Features

The repository includes a demo/ app and a sandbox/ project to showcase SnapAdmin's power:

  • Complete Project Setup: Ready-to-use Docker environment with PostgreSQL, Redis, and Elasticsearch.
  • Example Domain Models: Product, Customer, and Order models showing complex relationships.
  • Interactive Dashboard: A custom system dashboard with health checks and environment stats.
  • Seeder Command: python manage.py seed_demo to instantly populate your environment.
  • Celery Integration: Example background tasks for data indexing and stats generation.

🐳 Running the Demo (Docker)

git clone https://github.com/drofji/django-snapadmin.git
cd django-snapadmin
cp dist.env .env
docker compose up --build
  • Admin: http://localhost:8000/admin/ (admin / admin)
  • REST API Docs: http://localhost:8000/api/docs/
  • GraphQL API: http://localhost:8000/api/graphql/

💻 Local Development Setup

# Clone and setup environment
git clone https://github.com/drofji/django-snapadmin.git
cd django-snapadmin
python -m venv .venv
source .venv/bin/activate

# Install in editable mode
pip install -r requirements.txt
pip install -e .

# Initialize DB and run
python manage.py migrate
python manage.py seed_demo
python manage.py runserver

📜 License

MIT License — see LICENSE.

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_snapadmin-0.1.0a1.tar.gz (55.9 kB view details)

Uploaded Source

Built Distribution

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

django_snapadmin-0.1.0a1-py3-none-any.whl (62.7 kB view details)

Uploaded Python 3

File details

Details for the file django_snapadmin-0.1.0a1.tar.gz.

File metadata

  • Download URL: django_snapadmin-0.1.0a1.tar.gz
  • Upload date:
  • Size: 55.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for django_snapadmin-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 3c809db89dc9e96c683d4910c42a9172ac301a60248508b5c94bc2223ffcdf63
MD5 93cdea3fe5fb159ad8540b1e8787c19e
BLAKE2b-256 b515e48c57ff315ce84d41cf6c40f87939dc7a866cfe288a83dfd7ad51c26f76

See more details on using hashes here.

File details

Details for the file django_snapadmin-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_snapadmin-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d286a0cadf4242bdc26d2f47179a03ae19b9637ac3f150d39a74187bccdcb51
MD5 b03d05224159ef2993e89e8a411c8a24
BLAKE2b-256 da6900dc136aa99275e958b608d6f5e977ccb70f5330f878bd94598e36a3c67c

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