Centurion Abstract Model
This abstract model establishes the base features for ALL models within Centurion ERP
Bases: TenancyAbstractModel
Attributes
app_namespace
URL Application namespace.
Note: This attribute is a temp attribute until all models urls return
to their own urls.py
file from api/urls_v2.py
.
id
id = AutoField(blank=False, help_text='ID of the item', primary_key=True, unique=True, verbose_name='ID')
model_notes
model_notes = TextField(blank=True, help_text='Tid bits of information', null=True, verbose_name='Notes')
model_tag
Model Tag
String that is used as this models tag. Used within ticketing for linking a model to a ticket and wihin markdown for referencing a model.
url_model_name
URL Model Name override
Optionally use this attribute to set the model name for the url basename
,
i.e. _api_<url_model_name>
Classes
Functions
delete
Delete Centurion Model
If a model has _audit_enabled = True
, audit history is populated and
ready to be saved by the audit system (save signal.).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
using |
_type_
|
description. Defaults to None. |
None
|
keep_parents |
bool
|
Keep parent models. Defaults to the value if is_submodel so as not to delete parent models. |
None
|
get_after
Audit Data After Change
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
All model fields after the data changed |
get_app_namespace
Fetch the Application namespace if specified.
Note: This attribute is a temp attribute until all models urls return
to their own urls.py
file from api/urls_v2.py
.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Application namespace suffixed with colin |
None |
str
|
No application namespace found. |
get_audit_values
Retrieve the field Values
Currently ensures only fields are present.
ToDo: Update so the dict that it returns is a dict of dict where each dict is named after the actual models the fields come from and it contains only it's fields.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Model fields |
get_before
Audit Data Before Change
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
All model fields before the data changed |
get_history_model_name
Get the name for the History Model
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Name of the history model ( |
get_url
Return the models API URL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
relative |
bool
|
Return the relative URL for the model. Defaults to False. |
False
|
api_version |
int
|
API Version to use. Defaults to `2``. |
2
|
request |
any
|
Temp and unused attribute until rest of codebase re-written not to pass through. |
None
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
API URL for the model |
get_url_kwargs
Get URL Kwargs
Fecth the kwargs required for building a models URL using the reverse method.
Note: It's advisable that if you override this function, that you
call it's super, so as not to duplicate code. That way each override
builds up[on the parent get_url_kwargs
function.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Kwargs required for reverse function to build a models URL. |
save
Save Centurion Model
This Save ensures that full_clean()
is called so that prior to the
model being saved to the database, it is valid.
If a model has _audit_enabled = True
, audit history is populated and
ready to be saved by the audit system (save signal.).
About:
This page forms part of our Project Centurion ERP.
Page Metadata
Version: ToDo: place files short git commit hereDate Created: 2025-05-25
Date Edited: 2025-05-24
Contribution:
Would You like to contribute to our Centurion ERP project? You can assist in the following ways:
- Edit This Page If there is a mistake or a way you can improve it.
- Add a Page to the Manual if you would like to add an item to our manual
- Raise an Issue if there is something about this page you would like to improve, and git is unfamiliar to you.
ToDo: Add the page list of contributors