feat(core): cause sub-audit models to chuck a wobbler if clean_fields not re-implementated

ref: #770 #759
This commit is contained in:
2025-05-21 02:13:00 +09:30
parent a7f84924db
commit 504ded9047

View File

@ -128,9 +128,28 @@ class CenturionAudit(
def clean_fields(self, exclude = None):
def clean_fields(self, exclude: set = None):
"""Clean Model Fields
super().clean_fields(exclude = exclude)
The Audit Sub-Model that inherits from this model must implement this
method so as to populate the history fields with the history data.
Args:
exclude (set, optional): List of fields to exclude. Defaults to
None.
Raises:
NotImplementedError: The Audit sub-model that inheirts has failed
to implement this method.
"""
if not isinstance(self, CenturionAudit):
raise NotImplementedError(
'Audit sub models must implement this method to populate fields'
)
super().clean_fields( exclude = exclude )