Let model extensions define new fields #1774
No reviewers
Labels
No labels
Security
TeX
auto-update
board
done
board
ready
board
todo
check
delete-eslint-rc-js
check
update-builddeps-package-json
check
update-eslint-rc-js
check
update-gitignore
check
update-merge-request-template
check
update-prettier-ignore
check
update-pyproject-toml
check
update-renovate-json
check
update-tox-ini
part
backend
part
ci
part
docs
part
frontend
part
i18n
part
non-technical
part
packaging
prio
1
prio
2
prio
3
release-mr-5.x
size
large
size
medium
size
small
source
customer
source
customer::fsmw
source
customer::fss
source
customer::teckids
source
downstream
type
breaking
type
bug
type
feature
type
refactoring
workflow
blocked
workflow
confirmed
workflow
current-todo
workflow
discussing
workflow
new-app
workflow
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
aleksis/AlekSIS-Core!1774
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/extensible-models"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This MR extends the
ExtensibleModelto accept fields in addition to properties and methods. It leveragesdjango-jsonstorein order to aggregate those fields in oneextended_dataJSONField, so as to not need migrations when apps add additional fields. Apps should use this feature sparsely, and for more complex additions, add their own model with aForeignKeyinstead.The following example put in
model_extensions.pyof an app adds a field for the t-shirt size of a person:The fields are transparent to all known parts of Django. They are accessed like any other field, and even automagically show up in forms or a
ModelAdmin:Filtering on
JSONFieldis fully supported.Advances #141.
changed milestone to %"2.0a1"
changed the description
added 1 commit
Compare with previous version
added 1 commit
Compare with previous version
added 1 commit
9d866ef4- Hide JSON field from forms and ModelAdmin by defaultCompare with previous version
mentioned in issue #158
merged
mentioned in commit
79cb242b23mentioned in issue AlekSIS#7