I would like to create a model to store all actions related to particular models, like read, download, delete and etc. Is there any libraries for this or should I create multiple models with foreign key to track events?
Answers to your questions
I would like to create a model to store all actions related to particular models, like read, download, delete and etc. Is there any libraries for this or should I create multiple models with foreign key to track events?
if you want an audit history of changes to your model instances then you could take a look at https://django-simple-history.readthedocs.io/en/latest/.
if you are exposing your models via rest api you could use something like drf-api-tracking(disclaimer, I am the maintainer of drf-api-tracking). Or you could roll your own using django signals.
That seems like a lot of bloat to track all of this stuff.
What is your use case?
The `django.contrib.admin` app already contains an audit log. You could look there for some inspiration.
[django reversion](https://django-reversion.readthedocs.io/en/stable/) Is your friend. Stores an instance of each change to a model can easily revert to an old version via admin if needed.
This blog uses the LogEntry that comes with Django:
[https://medium.datadriveninvestor.com/monitoring-user-actions-with-logentry-in-django-admin-8c9fbaa3f442](https://medium.datadriveninvestor.com/monitoring-user-actions-with-logentry-in-django-admin-8c9fbaa3f442)