Skip to main content

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

Project description

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

Add to INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    # ...
    'djadmin',
    'djadmin_formset',  # Must come after djadmin
    # ...
]

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

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

djadmin_formset-0.1.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

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

djadmin_formset-0.1.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file djadmin_formset-0.1.0.tar.gz.

File metadata

  • Download URL: djadmin_formset-0.1.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for djadmin_formset-0.1.0.tar.gz
Algorithm Hash digest
SHA256 154c131b1ab1c025a2dd7e5b5530eab91eea8a005acbbbe6dd6ebc780c2dd4c8
MD5 ffc10507fe6878bb188f945353bdebce
BLAKE2b-256 8a9c6f25fd478c7abc9e50073316c696f447d5d62b28faa3b82c4fbadb3b78a4

See more details on using hashes here.

File details

Details for the file djadmin_formset-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for djadmin_formset-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7be0560f5747b13cda640396dae7e430ec66dfad4afa174f6312d81e3b0bdc7
MD5 82ff5d6d3e293451a1c43a85d3d43c9b
BLAKE2b-256 5886d2624ed637677735db454a9c2bdde1b8a4df6fa41ab483adba124550c7c4

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