I have 2 classes:
class ContactInternal(models.Model):
name = models.CharField(max_length=80)
SysAppApp = apps.get_app_config('SysApp')
SysAppModel = SysAppApp.models
reversion.register(ContactInternal, follow=["fk_contactinternal_sysapp"])
reversion.register(SysAppModel)
# SysApp from another app called 'SysApp'
class SysApp(models.Model):
name = models.CharField(max_length=80)
internalcontact = models.ForeignKey(ContactInternal, related_name='fk_contactinternal_sysapp', null=True, verbose_name="Internal Contact",blank=True,on_delete=models.SET_NULL)
It is working fine for most of the case. e.g. when I make a change to ContactInternal, a new version is made to SysApp. Pretty happy with how it works.
However if I delete a record linked from SysApp.internalcontact
, no version is created for SysApp.
Actually all I want to achieve is to get a timestamp of the last modified date of SysApp and by which user(don't need to rollback). I want to know
'When Peter delete a John from ContactInternal on 26th Feb, it will show Peter updated SysApp on 26th Feb'
How can I do it with django-reversion
? Or is there another way to achieve this?
- Note: There is another field in SysApp which is M2M I would like to achieve the same result too.