Party System — Developer Index
Entry point for the Enezaframework party system developer guides. Start here, then follow the links to the topic you need.
Table of Contents
- What the Party System Is
- The Problem It Solves
- The Core Idea
- Documentation Map
- Suggested Reading Paths
- A Note on Testing
What the Party System Is
The Generic Party System removes boilerplate from models that need address, contact, and person/organization profile data — Customer, Vendor, Contact, and any similar entity. Instead of hand-writing a party foreign key, party-creation logic, and detail-page inlines on every model, a developer adds PartyModelMixin and declares a party_category. The framework does the rest.
It is built on a single shared Party record plus optional profile records:
PersonandBusinessfor the party's identity (one-to-one).AddressandContactInformationfor reusable contact data (one-to-many).
Who it is for: Django developers and coding agents building ERP-style business apps on Enezaframework.
The Problem It Solves
Party-based entities repeat the same structure across every module. Before the mixin, each model needed:
- A manually declared
party = ForeignKey(Party, ...). - Hand-written
get_inline_related_objects()to expose Address, ContactInformation, and Person/Business inlines. - Hand-written
get_related_object_id()to resolve the profile IDs through the party. - Manual Party creation logic.
That is roughly 80+ lines of repeated boilerplate per model.
With PartyModelMixin the same model needs:
- Two base-class changes and a
party_categoryproperty. - At most a small
get_party_defaults()override.
That is roughly 15 lines of configuration.
The Core Idea
A model that inherits PartyModelMixin automatically:
- Gets a
partyforeign key to the sharedPartymodel. - Gets a backing
Partyrecord created on first save. - Gets a
PersonorBusinessprofile created from the party type. - Gets Address, ContactInformation, and the matching profile inline injected into its detail page.
- Gets
partyhidden from its forms.
flowchart LR
MODEL[Your model<br/>+ PartyModelMixin] --> PARTY[Shared Party record]
PARTY --> PROFILE[Person or Business profile]
PARTY --> ADDR[Address records]
PARTY --> CONTACT[ContactInformation records]
MODEL --> DETAIL[Detail page inlines<br/>auto-injected]
PARTY --> DETAILDocumentation Map
| Pos | Guide | What it covers |
|---|---|---|
| 1 | Party System — Developer Index | This page — overview, feature map, and navigation. |
| 2 | Party System Architecture | Components, layers, signal chain, app structure, and what the framework handles. |
| 3 | PartyModelMixin & Model Integration | Adding the mixin to a model, MRO, party_category, get_party_defaults(), related-name. |
| 4 | Party Types & Profiles | PRS/ORG, and the Party, Person, Business, Address, ContactInformation models. |
| 5 | Party System Quick Start | A minimal party-based model, its views, URLs, and menu entry. |
| 6 | Party View Layer | What you must define, what the framework provides, and what is optional. |
| 7 | Party Inline System | The static and conditional inlines auto-shown on a party-based detail page. |
| 8 | Party-Bridge Pattern | BaseInlineOneToOneDetailView auto-resolution for custom one-to-one inlines. |
| 9 | Party Template Context | party_object, main_object_pk, and the template variables in party partials. |
| 10 | Party System Migration | New models vs. converting existing models, and the related_name-only migration. |
| 11 | Party System Vendor Example | A complete VendorTable model + views walkthrough. |
| 12 | PartyModelMixin API Reference | Condensed API reference and signal chain. |
The original, unsplit reference remains available at party-system-developer-guide.md.
For the surrounding framework concepts, see the Enezaframework developer index:
- Base Models & Model Types
- CRUD Base Views
- Field & Inline UI Configuration
- Inline & Specialized Views
- Menu & Navigation Configuration
Suggested Reading Paths
New to party-based models 1. Party System Architecture 2. PartyModelMixin & Model Integration 3. Party System Quick Start
Converting an existing model 1. Party Types & Profiles 2. PartyModelMixin & Model Integration 3. Party System Migration
Building a custom one-to-one inline 1. Party Inline System 2. Party-Bridge Pattern 3. Party Template Context
A Note on Testing
Per project rules, the developer or agent does not run or claim test results. The user is solely responsible for all testing and validation of the output described in these guides.