vvangelovski / django-audit-log

Audit log for your Django models
Other
232 stars 93 forks source link

Creating a queryset for active data #44

Open gthieleb opened 7 years ago

gthieleb commented 7 years ago

I want to have access to the action_date, action_user attributes within a queryset. Goal is use this queryset for django-tables2 and django-import-export.

For django_table2 I can take an accessor like described here:

 accessor='audit_log.action_user'

But this way ordering fails as audit_log is no valid field.

Django import_export does not have accessor attribute at all.

My idea to workaround that is to build a queryset with a filter that excludes all but the active entries. How may achieve that?

Something like that comes to mind but I don't know what attribute of the audit_log model is related to the active model?

 models.PlannedMachine.audit_log.filter(id__in=PlannedMachine.objects.all())