Files
centurion_erp/app/core/models/centurion.py
Jon bff14dc21a refactor(core): adjust CenturionSubModel to not be it's own inheritable class
it's not required as the inheritance does not match the actual class'.

ref: #807 #767
2025-07-04 08:40:32 +09:30

52 lines
941 B
Python

from django.core.exceptions import (
ValidationError
)
from django.db import models
from access.fields import AutoCreatedField
from access.models.tenancy_abstract import TenancyAbstractModel
from core.mixins.centurion import Centurion
class CenturionModel(
Centurion,
TenancyAbstractModel,
):
class Meta:
abstract = True
id = models.AutoField(
blank=False,
help_text = 'ID of the item',
primary_key=True,
unique=True,
verbose_name = 'ID'
)
model_notes = models.TextField(
blank = True,
help_text = 'Tid bits of information',
null = True,
verbose_name = 'Notes',
)
created = AutoCreatedField(
editable = True
)
@staticmethod
def validate_field_not_none(value):
if value is None:
raise ValidationError(code = 'field_value_not_none', message = 'Value can not be none.')