soynatan / django-easy-audit

Yet another Django audit log app, hopefully the simplest one.
GNU General Public License v3.0
719 stars 178 forks source link

Get the edited object like in Django LogEntry() model #268

Open Stefan-ci opened 8 months ago

Stefan-ci commented 8 months ago

I know it's possible to get the edited object in a python code but hard in templates. So having a method to query/get the edited object directly would be a benefit (easier).

# easy-audit/models.py -> CRUDEvent()
def get_edited_object(self):
    """ Return the edited object represented by this CRUD event (Like Django LogEntry does). """
    return self.content_type.get_object_for_this_type(pk=self.object_id)