GitHub

Templates

Real-world Django + HTMX template patterns using UX components. These examples come from ERPlora, an ERP system with 302 templates across 17 modules — all built with UX CSS.

Modules using UX

Module Templates Module Templates
Loyalty26Appointments24
Staff22Orders21
Inventory21Services21
Commissions20Returns20
Invoicing17Reservations17
Discounts16Sales16
VeriFACTU16Kitchen14
Cash Register11Customers11
Total302

Template Architecture

Page + Partial Pattern

Every view has two templates: a page (extends layout, includes partial) and a partial (the actual content). Full requests get the page; HTMX requests get just the partial — zero duplication.

Page Template (extends layout)

{% raw %}{% extends "dashboard/layout.html" %} {% load i18n djicons %} {% block page_title %}{% trans "Sales" %}{% endblock %} {% block content %} {% with current_section="sales" section_title=_("Sales") %} {{ block.super }} {% endwith %} {% endblock %} {% block dashboard_content %} {% include "sales/partials/content.html" %} {% endblock %}{% endraw %}

Dashboard Pattern

Stats grid + recent activity + quick actions. Used in every module's index page.

Sales Dashboard (real template)

Preview

Sales

Sales management and point of sale

Sales Today
24
Revenue Today
$1,847.50
This Week
142
Week Revenue
$12,340.00

Recent Sales

VTA-0024
07/02/2026 14:32 - Ana Garcia
$245.00
Card
VTA-0023
07/02/2026 13:15
$89.90
Cash

Payment Methods (Today)

MethodCountTotal
Cash
12$623.50
Card
10$1,024.00
Transfer
2$200.00

List Pattern

Searchable, filterable list with HTMX navigation. Every module has at least one list view.

Loyalty Members List

Settings Pattern

Toggle and input settings that save immediately via HTMX POST, no form submission needed.

Orders Settings (instant save)

Preview

Kitchen Display

Auto Print Tickets Print kitchen tickets automatically when orders fire
Show Prep Time Display elapsed preparation time on orders
Alert Threshold Minutes before flagging as delayed

Empty State Pattern

Friendly empty states with icon, message, and call-to-action button.

Empty States (3 variants)

Preview

No sales yet

No results for "pizza"

No members yet

Enroll customers in the loyalty program to start earning points

Django Template Reference

HTMX SPA Navigation

All internal links use HTMX to swap content without full page reload:

<a hx-get="{% url 'sales:detail' sale.id %}"
   hx-target="#main-content-area"
   hx-push-url="true"
   class="list-item list-item-clickable">
  ...
</a>
Icons (djicons)

Ionicons via Django template tag:

{% load djicons %}
{% icon "receipt-outline" class="text-2xl text-primary" %}
{% icon "cash-outline" class="text-xl text-success" %}
{% icon "alert-circle-outline" class="text-warning" %}
Internationalization

All user-visible text uses Django i18n:

{% load i18n %}
{% trans "Recent Sales" %}
{% trans "No results found" %}
Delete with Confirmation

JavaScript confirm + fetch + HTMX redirect:

<button onclick="deleteItem()" class="btn color-danger btn-sm">Delete</button>

<script>
function deleteItem() {
  if (confirm('Delete this item?')) {
    fetch('{% url "orders:delete" order.id %}', {
      method: 'POST',
      headers: {'X-CSRFToken': '{{ csrf_token }}'},
    }).then(r => {
      if (r.ok) htmx.ajax('GET', '{% url "orders:active_orders" %}', '#main-content-area');
    });
  }
}
</script>
Color-Coded Status Badges

Map model status to badge colors in templates:

{% if order.status == 'pending' %}
  <span class="badge color-warning badge-soft">Pending</span>
{% elif order.status == 'preparing' %}
  <span class="badge color-primary badge-soft">Preparing</span>
{% elif order.status == 'ready' %}
  <span class="badge color-success">Ready</span>
{% elif order.status == 'cancelled' %}
  <span class="badge color-danger badge-soft">Cancelled</span>
{% endif %}