Skip to content

Getting Started

Ready after setup?

Once you have the basics installed, continue with Setup & Core CRUD basics for the full walkthrough.

Installation

Install Core Dependencies

pip install neapolitan
pip install django-powercrud

This automatically installs:

  • django-htmx
  • django-template-partials
  • pydantic

install Frontend Dependencies

You'll need to include these JavaScript libraries in your base template:

Default styling:

  • daisyUI v5 with Tailwind CSS v4
  • Bootstrap Icons (for sorting indicators)

Choose Your Frontend Install Methods

There are many ways to include JavaScript (CDN, npm, Vite, etc.) - use whatever works for your project.* See the example base template in sample/templates/sample/daisyUI/base.html for a complete implementation with CDN links.

Settings Configuration

Add to your settings.py:

# Required settings
INSTALLED_APPS = [
    ...
    "powercrud",
    "neapolitan",
    "django_htmx",
    "template_partials",
    ...
]

# Optional: POWERCRUD_SETTINGS overrides (all keys are optional and have defaults)
POWERCRUD_SETTINGS = {
    "POWERCRUD_CSS_FRAMEWORK": "daisyui",  # built-in default
}

Important: If using Tailwind CSS (default), ensure Tailwind includes powercrud's classes in its build process. See the Styling guide 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

PowerCRUD’s UrlMixin (inherited from Neapolitan) exposes get_urls() so you do not have to hand-write the five CRUD routes. Pick the style that suits your project:

from django.urls import path, include
from neapolitan.views import Role
from .views import ProjectCRUDView

app_name = "my_app"  # keep namespaces aligned with your include()

urlpatterns = []
urlpatterns += ProjectCRUDView.get_urls()

If you prefer the unpack pattern:

urlpatterns = [
    *ProjectCRUDView.get_urls(),
]

Need fewer routes (and therefore fewer action buttons)? Limit the registered roles:

urlpatterns = [
    *ProjectCRUDView.get_urls(roles={Role.LIST, Role.DETAIL}),
]

Only the List and View endpoints (and their buttons) will render in that case. Finally, include the app URLs at the project level as usual:

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

urlpatterns = [
    path("projects/", include("my_app.urls")),
]

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