feat(core): Add audithistory URL to serializer for models with _audit_enabled=True

ref: #773 #767 #759
This commit is contained in:
2025-05-27 07:37:47 +09:30
parent 26b5aa7f45
commit 21e7d7b444

View File

@ -91,9 +91,22 @@ class CommonModelSerializer(CommonBaseSerializer):
history_model_name = item.history_model_name
if(
if getattr(self.Meta.model, '_audit_enabled', False):
get_url['history'] = reverse(
"v2:_api_centurionaudit_sub-list",
request = self._context['view'].request,
kwargs = {
'app_label': history_app_label,
'model_name': history_model_name,
'model_id': item.pk
}
)
elif(
history_app_label is not None
and history_model_name is not None
and not hasattr(self.Meta.model, '_audit_enabled')
):
get_url['history'] = reverse(