Skip to main content

djadmin-formset

Django-formset integration plugin for django-admin-deux Layout API.

Overview

This plugin provides full django-formset FormCollection support for the django-admin-deux Layout API, enabling advanced form features:

  • Inline Editing: Collection components for related objects
  • Conditional Fields: Show/hide fields based on other field values
  • Computed Fields: Auto-calculate field values from expressions
  • Client-Side Validation: Real-time validation without page refresh
  • Drag-and-Drop Ordering: Sortable collections
  • Progressive Enhancement: Works alongside core djadmin without breaking basic forms

Installation

# Install from PyPI (when published)
pip install djadmin-formset

# Or install with django-admin-deux
pip install django-admin-deux[djadmin-formset]

Configuration

Automatic Configuration (Recommended)

Use djadmin_apps() for zero-configuration setup:

# settings.py
from djadmin import djadmin_apps

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    # ... other Django apps
    'myapp',
] + djadmin_apps()  # Automatically includes djadmin-formset in correct order

The plugin system automatically:

  • Installs djadmin_formset BEFORE djadmin for template override
  • Installs formset dependency
  • Handles all ordering requirements

Manual Configuration

If you need manual control over INSTALLED_APPS:

INSTALLED_APPS = [
    # ... Django apps ...
    'formset',           # django-formset (dependency)
    'djadmin_formset',   # MUST come BEFORE djadmin for template overrides
    'djadmin',
    # ...
]

CRITICAL: djadmin_formset MUST appear before djadmin in INSTALLED_APPS. This ensures Django's template loader finds the FormCollection templates before the standard form templates.

Usage

Basic Inline Editing

from djadmin import ModelAdmin, register, Layout, Field, Collection

@register(Author)
class AuthorAdmin(ModelAdmin):
    layout = Layout(
        Field('name'),
        Field('birth_date'),
        Collection('books',
            model=Book,
            fields=['title', 'isbn', 'published_date'],
            is_sortable=True,
        ),
    )

Conditional Fields

from djadmin import ModelAdmin, register, Layout, Field

@register(Product)
class ProductAdmin(ModelAdmin):
    layout = Layout(
        Field('name'),
        Field('product_type'),
        Field('weight', show_if=".product_type === 'physical'"),
        Field('file_size', show_if=".product_type === 'digital'"),
    )

Computed Fields

from djadmin import ModelAdmin, register, Layout, Field, Row

@register(OrderItem)
class OrderItemAdmin(ModelAdmin):
    layout = Layout(
        Row(
            Field('quantity', css_classes=['flex-1']),
            Field('price', css_classes=['flex-1']),
            Field(
                'total',
                calculate='.quantity * .price',
                css_classes=['flex-1']
            ),
        ),
    )

Features Provided

This plugin advertises the following features to the djadmin core:

  • collections / inlines - Inline editing support
  • conditional_fields - Show/hide field logic
  • computed_fields - Auto-calculated fields

Requirements

  • Python 3.11+
  • Django 5.2+
  • django-admin-deux >= 0.1.0
  • django-formset >= 1.3

Development Status

Status: Alpha - Day 18 of Milestone 3 implementation (Phase 2 complete)

This plugin is under active development as part of Milestone 3 (Layout API & Django-Formset Integration).

Completed:

  • ✅ FormFactory - converts layouts to FormCollections
  • ✅ DjAdminFormRenderer - Tailwind CSS themed renderer
  • ✅ Plugin hooks - mixin-based form conversion
  • ✅ Template overrides - django-formset JS/CSS integration
  • ✅ Integration tests - all features tested
  • ✅ Comprehensive documentation - 5+ guides

In Progress:

  • 📋 Final polish and release preparation (Days 19-20)

Documentation

Comprehensive documentation available in the main django-admin-deux docs:

Core Documentation

Plugin Documentation

License

MIT License - See LICENSE file for details

Metadata

Release files for djadmin-formset 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djadmin-formset 0.1.3
File Size Uploaded Provenance Actions
djadmin_formset-0.1.3.tar.gz 27.8 kB Without provenance Details for djadmin_formset-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for djadmin-formset 0.1.3
File Interpreter ABI Platform Actions
djadmin_formset-0.1.3-py3-none-any.whl Python 3 none any Details for djadmin_formset-0.1.3-py3-none-any.whl

Total release size: 55.1 kB

Release files / djadmin_formset-0.1.3.tar.gz

Download URL djadmin_formset-0.1.3.tar.gz
Size 27.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dc9aed6b8adbcda2ef64c82d68f336cca3c6a28b8c2a1a0a6a4a944a104d0a60
BLAKE2b-256 checksum
How to use checksums
c94a97d1c88665fd9c45e971aabeb7a4c808b29f2b904abfea988c4f883d5112
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / djadmin_formset-0.1.3-py3-none-any.whl

Download URL djadmin_formset-0.1.3-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
550024900bcb66a5e4d473c79a252083d233a8ede04f4b2d7d686bdfe8b349a4
BLAKE2b-256 checksum
How to use checksums
d53d21d3750d924894422f832984c0d97059923f2f7ad1bb39c39501f41e17d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for djadmin-formset 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page