Skip to content

History Save


Bases: Model

Attributes

fields

fields

save_model_history

save_model_history: bool = True

When set, history will be saved. By default, ALL models must save history.

Classes

Meta

Attributes

abstract
abstract = True

Functions

delete

delete(using=None, keep_parents=False)

save

save(force_insert=False, force_update=False, using=None, update_fields=None)

OverRides save for keeping model history.

Not a Full-Override as this is just to add to existing.

Before to fetch from DB to ensure the changed value is the actual changed value and the after is the data that was saved to the DB.

save_history

save_history(before: dict, after: dict, history_model=None) -> bool

Save Model History

This method must be re-implemented by the model class in question so that the history model can be passed to this function.

Parameters:

Name Type Description Default
before dict

Model data before the change

required
after dict

Model data after the change

required
history_model Model

History model class

None

Returns:

Name Type Description
False bool

Failed to save history

True bool

Successfully saved history

None None

history_model was not specified

About:

This page forms part of our Project Centurion ERP.

Page Metadata
Version: ToDo: place files short git commit here
Date Created: 2024-06-16
Date Edited: 2024-07-13

Contribution:

Would You like to contribute to our Centurion ERP project? You can assist in the following ways:

 

ToDo: Add the page list of contributors