Getting Started
Installation
Install Core Dependencies
This automatically installs:
django
django-template-partials
pydantic
install Frontend Dependencies
You'll need to include these JavaScript libraries in your base template:
- HTMX - Install from htmx.org
- Popper.js - For table column text truncation popovers
- Alpine.js - If using modals
Default styling:
- daisyUI v5 with Tailwind CSS v4
- Bootstrap Icons (for sorting indicators)
- Bootstrap 5 CSS and JS (if using bootstrap5 framework)
Choose Your Frontend Install Methods
There are many ways to include JavaScript (CDN, npm, Vite, etc.) - use whatever works for your project.*
Bootstrap Templates Outdated
Bootstrap templates are currently out of date as all recent development has focused on daisyUI
. Once async support is finalised and tested, Bootstrap templates will either be updated or removed.
See the example base template in django_powercrud/templates/django_powercrud/base.html
for a complete implementation with CDN links.
Settings Configuration
Add to your settings.py
:
# Required settings
INSTALLED_APPS = [
...
"powercrud",
"neapolitan",
"django_htmx",
...
]
# Optional: Set CSS framework (default is 'daisyui')
NOMINOPOLITAN_CSS_FRAMEWORK = 'daisyui' # or 'bootstrap5'
Important: If using Tailwind CSS (default), ensure Tailwind includes powercrud's classes in its build process. See Styling Configuration for details.
Quick Start Tutorial
Basic Setup
Start with a basic CRUD view. For reference see neapolitan
's docs.
from powercrud.mixins import PowerCRUDMixin
from neapolitan.views import CRUDView
from . import models
class ProjectCRUDView(PowerCRUDMixin, CRUDView):
model = models.Project
fields = ["name", "owner", "last_review", "status"]
base_template_path = "core/base.html"
Add to URLs
# urls.py
from django.urls import path, include
app_name = "my_app" # Optional namespace
urlpatterns = [
path("projects/", ProjectCRUDView.as_view(), name="project"),
]
Your First Enhanced View
Add some powercrud features:
class ProjectCRUDView(PowerCRUDMixin, CRUDView):
model = models.Project
base_template_path = "core/base.html"
# Basic field control
fields = ["name", "owner", "status", "created_date"]
properties = ["is_overdue"] # Include @property fields
# Enable modern features
use_htmx = True
use_modal = True
# Add filtering
filterset_fields = ["owner", "status", "created_date"]
# Enable pagination
paginate_by = 25
# Optional: namespace for URLs
namespace = "my_app"
That's it! You now have a fully-featured CRUD interface with filtering, pagination, modals, and HTMX support.
Next Steps
- Core Configuration - Field control and basic settings
- HTMX & Modals - Interactive features
- Filtering - Advanced search and filter options
- Bulk Operations - Edit multiple records at once