Skip to main content

A Django admin system with tools for building custom admin interfaces and reusable components

Project description

🎨 django-palette

Build beautiful, dynamic Django admin pages using drag-and-drop components.

django-palette gives developers and power users the ability to customize Django’s admin interface using a modern layout system, Bootstrap components, and a flexible templating engine — all without losing the power of Django’s permissions and admin tools.


✨ Features

  • 🖼️ Custom AdminSite with Bootstrap styling
  • ⚙️ Extendable via custom components and template tags
  • 🧩 Live-rendered UI components via {% palette_ui %}
  • 🔧 Drag-and-drop editor (optional, configurable)
  • 🔐 Fully supports Django auth and permission system
  • 🧠 Works with existing apps and models, zero migration needed

📦 Installation

pip install dj-palette

⚙️ Setup

In your settings.py, add it above Django's admin so it takes precedence:

INSTALLED_APPS = [
    'dj_palette',  # Must come before 'django.contrib.admin'
    'django.contrib.admin',
    ...
]

Then in your urls.py, register your custom admin site:

from dj_palette.admin import palette_admin_site
from django.urls import path

urlpatterns = [
    path('admin/', palette_admin_site.urls),
]

🧩 Usage

Render a UI Component Inline

Render a component directly in a template with props:

{% load palette %}

{% palette_ui "palette/components/card.html" with title="Total Users" content="123" onclick="alert('Hello')" %}

Extend a UI Component Block

Use the block form to add custom HTML below the component:

{% palette_ui file="palette/components/card.html" component="card" with title="Active Users" %}
  <p class="text-muted">More details here...</p>
{% endpalette_ui %}

🛠 Built-in Tags

  • palette_ui — render and optionally extend a UI component
  • render_ui — legacy/simple usage to render from a component string
  • back_button — generates a back URL for the change/add form

🧱 Custom Components

To create a custom component:

  1. Place your component in templates/palette/components/your_component.html
  2. Use template variables for inputs like title, content, or onclick
  3. Render it via {% palette_ui %} or |render_ui filter

Example: card.html

<div class="card">
  <div class="card-body">
    <h5 class="card-title">{{ title }}</h5>
    <p class="card-text">{{ content }}</p>
    {% if onclick %}
      <button onclick="{{ onclick }}" class="btn btn-sm btn-outline-primary">Action</button>
    {% endif %}
  </div>
</div>

🖥️ Admin Pages & Dashboard

Out of the box, django-palette replaces the default dashboard and allows you to define new pages like:

  • /admin/dashboard/ → your custom index
  • /admin/pages/<slug>/ → render a saved page layout
  • /admin/pages/edit/<slug>/ → page builder/editor (optional)

These are configured in dj_palette/admin.py.


✏️ Configuration

You can configure UI options using PALETTE_SETTINGS in your settings file:

PALETTE_SETTINGS = {
    "site_header": "My Admin",
    "index_title": "Dashboard",
    "custom_links": [
        {
            "label": "Support",
            "url_name": "admin:support_chat",
            "left_icon": "bi bi-chat-dots"
        }
    ],
    "show_editor": True,  # enables drag-and-drop editor
}

🧪 Example Admin Dashboard

{% extends "admin/base_site.html" %}
{% load palette %}

{% block content %}
  <div class="row">
    <div class="col-md-4">
      {% palette_ui file="palette/components/card.html" component="card" with title="Total Users" content="1000" %}
      {% palette_override card_body %}
        <p class="small text-muted">Based on active records</p>
      {% endpalette_override %}
      {% endpalette_ui %}
    </div>
  </div>
{% endblock %}

🧩 Upcoming Features

  • Component nesting with slots
  • Live preview in the editor

🤝 Contributing

Want to contribute? Fork this repo and submit a pull request!

  1. Clone the repo
  2. Activate your virtualenv and run pip install -e .
  3. Create your feature branch (git checkout -b feature/your-feature)
  4. Commit your changes (git commit -am 'Add cool feature')
  5. Push and open a PR

📄 License

MIT License © 2025 [Joel Ogofe Tanko]


📚 Documentation

More docs & examples coming soon at: https://dj-palette.readthedocs.io

Need help? Open an issue or reach out directly.

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

dj_palette-1.0.0.tar.gz (484.1 kB view details)

Uploaded Source

Built Distribution

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

dj_palette-1.0.0-py3-none-any.whl (494.9 kB view details)

Uploaded Python 3

File details

Details for the file dj_palette-1.0.0.tar.gz.

File metadata

  • Download URL: dj_palette-1.0.0.tar.gz
  • Upload date:
  • Size: 484.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for dj_palette-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6277cd779916e11ed5e5f051ec935b007799614a01d51cc835f38784869a7e51
MD5 e441080e1f101aab964e15c49eb2b551
BLAKE2b-256 f7511a5bcbce9fd6af56e83283409d9331904d3fb8092b42f47a84c1a46297d6

See more details on using hashes here.

File details

Details for the file dj_palette-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dj_palette-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 494.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for dj_palette-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3178ce470fc3e3e3b947eac14c83f47d758f9eb3e5486ec5e69dd28cb87dcab7
MD5 9ca0f1a4d57dc07fde783df40c53e3d5
BLAKE2b-256 5880dc94bd83aa21eab6299f986ddab5679927a93de604c50e61ad97694d240c

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