dj-models: tighten admin fieldsets with Important Dates convention#11
Open
ashbrener wants to merge 1 commit into
Open
dj-models: tighten admin fieldsets with Important Dates convention#11ashbrener wants to merge 1 commit into
ashbrener wants to merge 1 commit into
Conversation
Expands the fieldsets rule from a single "place id + timestamps in the first fieldset" guideline to the three-band pattern production codebases on this stack converge on: 1. Untitled (None) fieldset: id + primary natural key only 2. Named semantic sections: Personal Info, Details, Role & Permissions, Security, Relations — grouped by meaning, not DB order 3. "Important Dates" (always last, title case): every datetime field — created_at, updated_at, deleted_at, last_login, date_joined Separating dates from identifiers keeps the top of the change view focused on what identifies the record; named middle sections make domain fields scannable; the trailing date block is low-attention where dates deserve to be. Also adds add_fieldsets guidance for models that support admin creation (User primarily) — minimal form with just required fields for a new record.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expands the
fieldsetsrule indj-modelsfrom a single guideline to a three-band semantic pattern:None) fieldset —id+ primary natural key only (e.g.email/slug). Identifiers always visible at top."Personal Info","Details","Role & Permissions","Security","Relations". Grouped by meaning, not DB column order."Important Dates"(always last, title case) — every datetime field lands here (created_at,updated_at,deleted_at,last_login,date_joined).Also adds
add_fieldsetsguidance for creation forms (User primarily) — minimal required fields only.Motivation
The current rule says "place identifiers and timestamps in the first fieldset." In practice, production codebases separate the two bands — identifiers in the untitled top fieldset, dates in a trailing
"Important Dates"section. The split makes the top of the change view focused (just identity), the middle scannable (domain grouped by meaning), and keeps low-attention temporal fields out of the way.The Django admin itself uses
"Important dates"(lowercase d) on the default User admin. Standardizing on title case ("Important Dates") matches the other fieldset names in the skill's convention.What changes
skills/dj-models/SKILL.md— replaces the singlefieldsetsbullet with:add_fieldsetson creatable modelsTradeoffs
"Details"as a catchall lets teams name domain sections appropriately for their models.