django-auditlog
django-auditlog copied to clipboard
Django Admin - Log Entries - verbose_name not being shown in changes (msg) field
The documentation says that the verbose_name is supposed to be shown in the django admin log entries, but we can only see the field names, not the verbose names. We have tried mapping_fields in auditlog.register as well but that doesn't work either. We are using 2.0.0
What do you mean by
verbose_name is supposed to be shown in the django admin log entries?
I checked the doc and it seems that verbose_name is used for changes_display_dict and it is working.
Consider the following model with mapping_fields:
class MyModel(modelsModel):
sku = models.CharField(max_length=20)
version = models.CharField(max_length=5)
product = models.CharField(max_length=50, verbose_name='Product Name')
history = AuditlogHistoryField()
auditlog.register(MyModel, mapping_fields={'sku': 'Product No.', 'version': 'Product Revision'})
Then by creating a simple object of MyModel:
MyModel.objects.create(sku='1', version='1', product='1')
You will find the following result for changes_display_dict:
log = MyModel.objects.first().history.latest()
print(log.changes_display_dict)
{'ID': ['None', '1'], 'Product Name': ['None', '1'], 'Product No.': ['None', '1'], 'Product Revision': ['None', '1']}