Gist 6138a5680dbc66f83c6d
✓ Published0🌍 Public
Aandybak
Last edited Jul 4, 2014
Created on Jul 4, 2014
This example demonstrates a Django admin customization module that renders reverse foreign-key and one-to-one relationships as inline formsets, replacing the default select-box interface. The code uses Django’s `ModelAdmin`, `InlineModelAdmin`, and `BaseModelFormSet` to create `ReverseInlineFormSet`, which limits the formset to a single existing object or a single empty form, and supports tabular or stacked layouts via `inline_type`. It also references Django’s `csrf_protect_m`, `flatten_fieldsets`, and formset validation utilities, with the source being a gist by andybak adapted for Django 1.6.
AI-generated description