{"id":13416103,"url":"https://github.com/soynatan/django-easy-audit","last_synced_at":"2026-01-07T06:25:45.254Z","repository":{"id":12356246,"uuid":"71686939","full_name":"soynatan/django-easy-audit","owner":"soynatan","description":"Yet another Django audit log app, hopefully the simplest one.","archived":false,"fork":false,"pushed_at":"2025-04-19T03:04:34.000Z","size":298,"stargazers_count":785,"open_issues_count":106,"forks_count":193,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-19T10:57:37.953Z","etag":null,"topics":["audit","audit-logs","auditing","crud","django","django-application"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soynatan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-23T06:55:16.000Z","updated_at":"2025-04-19T03:02:15.000Z","dependencies_parsed_at":"2024-01-11T19:17:27.025Z","dependency_job_id":"7fa593f0-f057-4781-9ee0-74cc7ec1438b","html_url":"https://github.com/soynatan/django-easy-audit","commit_stats":{"total_commits":262,"total_committers":48,"mean_commits":5.458333333333333,"dds":0.66793893129771,"last_synced_commit":"348d991aee9eb94cd61f761829f07da763d60ff7"},"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soynatan%2Fdjango-easy-audit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soynatan%2Fdjango-easy-audit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soynatan%2Fdjango-easy-audit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soynatan%2Fdjango-easy-audit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soynatan","download_url":"https://codeload.github.com/soynatan/django-easy-audit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254044043,"owners_count":22005064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audit","audit-logs","auditing","crud","django","django-application"],"created_at":"2024-07-30T21:00:54.352Z","updated_at":"2026-01-07T06:25:45.236Z","avatar_url":"https://github.com/soynatan.png","language":"Python","funding_links":[],"categories":["Third-Party Packages","Django Utilities"],"sub_categories":["Views"],"readme":"# django-easy-audit\n\n[![pypi](https://img.shields.io/pypi/v/django-easy-audit.svg)](https://pypi.org/project/django-easy-audit/)\n![PyPI - Django Version](https://img.shields.io/pypi/frameworkversions/django/django-easy-audit)\n\nYet another Django audit log app, hopefully the easiest one.\n\nThis app allows you to keep track of every action taken by your users.\n\n## Quickstart\n\n1. Install Django Easy Audit by running `pip install django-easy-audit`.\n\n   _Alternatively, you can download the [latest release](https://github.com/soynatan/django-easy-audit/releases) from GitHub, unzip it, and place the folder 'easyaudit' in the root of your project._\n\n2. Add 'easyaudit' to your `INSTALLED_APPS` like this:\n\n   ```python\n   INSTALLED_APPS = [\n       ...\n       'easyaudit',\n   ]\n   ```\n\n3. Add Easy Audit's middleware to your `MIDDLEWARE` (or `MIDDLEWARE_CLASSES`) setting like this:\n\n   ```python\n   MIDDLEWARE = (\n       ...\n       'easyaudit.middleware.easyaudit.EasyAuditMiddleware',\n   )\n   ```\n\n4. Run `python manage.py migrate easyaudit` to create the app's models.\n\n5. That's it! Now every CRUD event on your whole project will be registered in the audit models, which you will be able to query from the Django admin app. Additionally, this app will also log all authentication events and all URLs requested.\n\n## Settings\n\nFor an exhaustive list of available settings, please [check our wiki](https://github.com/soynatan/django-easy-audit/wiki/Settings).\n\nBelow are some of the settings you may want to use. These should be defined in your project's `settings.py` file:\n\n- `DJANGO_EASY_AUDIT_WATCH_MODEL_EVENTS`\n\n- `DJANGO_EASY_AUDIT_WATCH_AUTH_EVENTS`\n\n- `DJANGO_EASY_AUDIT_WATCH_REQUEST_EVENTS`\n\n  Set these to `False` to stop logging model, authentication, and/or request events.\n\n- `DJANGO_EASY_AUDIT_UNREGISTERED_CLASSES_EXTRA`\n\n  A list of Django models which will be ignored by Django Easy Audit.\n  Use it to prevent logging one or more of your project's models.\n  List items can be classes or strings with `app_name.model_name` format.\n\n- `DJANGO_EASY_AUDIT_UNREGISTERED_URLS_EXTRA`\n\n  A list of URLs which will be ignored by Django Easy Audit.\n  List items are expected to be regular expressions that\n  will be matched against the URL path.\n  [Check our wiki](https://github.com/soynatan/django-easy-audit/wiki/Settings#request-auditing)\n  for more details on how to use it.\n\n- `DJANGO_EASY_AUDIT_CRUD_DIFFERENCE_CALLBACKS`\n\n  May point to a list of callables/string-paths-to-functions-classes in which the application code can determine\n  on a per CRUDEvent whether or not the application chooses to create the CRUDEvent or not. This is different\n  from the registered/unregistered settings (e.g. `DJANGO_EASY_AUDIT_UNREGISTERED_CLASSES_EXTRA`).\n  This is meant to be for dynamic configurations where the application\n  may inspect the current save/create/delete and choose whether or not to save that into the database or ignore it.\n\n- `DJANGO_EASY_AUDIT_USER_DB_CONSTRAINT`\n\n  Default is `True`. This is reserved for future use (does not do anything yet). The functionality provided by the\n  setting (whether enabled or disabled) could be handled more explicitly in certain\n  code paths (or even internally as custom model managers). For projects that separate the easyaudit database, such\n  that the tables are not on the same database as the user table, this could help with making certain queries easier.\n  Again, this doesn't do anything yet, and if it ever does, the version will be increased and the README will be\n  updated accordingly. If you keep your database together (the standard usage), you have nothing to worry about.\n\n- `DJANGO_EASY_AUDIT_CRUD_EVENT_LIST_FILTER`\n\n- `DJANGO_EASY_AUDIT_LOGIN_EVENT_LIST_FILTER`\n\n- `DJANGO_EASY_AUDIT_REQUEST_EVENT_LIST_FILTER`\n\n  Changeview filters configuration.\n  Used to remove filters when the corresponding list of data would be too long.\n  Defaults are:\n\n  - ['event_type', 'content_type', 'user', 'datetime', ] for CRUDEventAdmin\n  - ['login_type', 'user', 'datetime', ] for LoginEventAdmin\n  - ['method', 'user', 'datetime', ] for RequestEventAdmin\n\n- `DJANGO_EASY_AUDIT_DATABASE_ALIAS`\n\n  By default it is the Django `default` database alias. But for projects that have split databases,\n  this is necessary in order to keep database atomicity concerns in check during signal handlers.\n\n  To clarify, this is only _truly_ necessary for the model signals.\n\n- `DJANGO_EASY_AUDIT_PROPAGATE_EXCEPTIONS`\n\n  Default is `False`. When set to `True`, easyaudit will propagate exceptions occurred in own signal handlers. The\n  recommended approach is to use Django's `DEBUG` setting in order to only propagate errors in development:\n\n  ```python\n  DJANGO_EASY_AUDIT_PROPAGATE_EXCEPTIONS = DEBUG\n  ```\n\n- `DJANGO_EASY_AUDIT_CRUD_EVENT_NO_CHANGED_FIELDS_SKIP`\n\n  By default this is `False`, but this allows the calling project not to save `CRUDEvent` if the changed fields as\n  determined by the `pre_save` handler sees that there are no changed fields. We are keeping it off by default so that\n  projects that wish to use this (potentially less `CRUDEvent`) can choose to turn it on! And those that do not want it (yet or ever),\n  or those that do not closely follow the release notes of this project will have one less worry when upgrading.\n\n- `DJANGO_EASY_AUDIT_CHECK_IF_REQUEST_USER_EXISTS`\n\n  By default this is `True`, but this allows the calling project to make easyaudit ignore user validation on audit event creation.\n  This is useful when you have a app with soft delete or no delete on users model. With this set to `False`, easyaudit only fetch `request.user` for audit event creation, no db check is made, meaning you can speed up audit events creation and save some DB calls.\n\n- `DJANGO_EASY_AUDIT_READONLY_EVENTS`\n\n  Default is `False`. The events visible through the admin interface are editable by default by a\n  superuser. Set this to `True` if you wish to make the recorded events read-only through the admin\n  UI.\n\n- `DJANGO_EASY_AUDIT_LOGGING_BACKEND`\n\n  A pluggable backend option for logging. Defaults to `easyaudit.backends.ModelBackend`.\n  This class expects to have 3 methods:\n\n  - `login(self, login_info_dict):`\n  - `crud(self, crud_info_dict):`\n  - `request(self, request_info_dict):`\n\n  each of these methods accept a dictionary containing the info regarding the event.\n  example overriding:\n\n  ```python\n    import logging\n\n    class PythonLoggerBackend:\n        logging.basicConfig()\n        logger = logging.getLogger('your-kibana-logger')\n        logger.setLevel(logging.DEBUG)\n\n        def request(self, request_info):\n            return request_info # if you don't need it\n\n        def login(self, login_info):\n            self.logger.info(msg='your message', extra=login_info)\n            return login_info\n\n        def crud(self, crud_info):\n            self.logger.info(msg='your message', extra=crud_info)\n            return crud_info\n  ```\n\n## What does it do\n\nDjango Easy Audit uses [Django signals](https://docs.djangoproject.com/en/dev/topics/signals/)\nto listen to the events happening in your project, such as when a user creates, updates or deletes\na registry. This applies to every model of every app in your project.\n\nWhen any of these events takes place, Django Easy Audit will log it in the model `CRUDEvent`.\nYou can query this information in the Django Admin app.\n\nBesides logging CRUD events, Django Easy Audit will log all authentication events (such as when a user logs in, out, or fails to log in) and all the URLs requested in the project. This information is stored in models `LoginEvent` and `RequestEvent`.\n\n## Why you should use it\n\nThere are many Django auditing apps out there, but most them require you to change very important\nparts of your project's code. For example, they require you to add fields to your models, or make\nthem inherit from a certain class. Some of them create a mirror for each of your models, which means\nduplicate migrations.\n\nIt is not that they don't work or that they are not great apps. But in case you need something\neasier to set up, and you don't want your code to depend so much on a third-party app, Django Easy Audit\nmay be your best choice.\n\nThe good thing about this app is that it doesn't get in the way. It is [easy and quick to install](https://github.com/soynatan/django-easy-audit/wiki/Installation), and it\nbegins logging everything right away, without you having to inject code anywhere in your project.\n\n## Contributing\n\nInterested in contributing to `django-easy-audit`? Please read our [Contribution guide](CONTRIBUTING.md).\n\n## Contact\n\nFind me on Twitter at [@soynatan](https://twitter.com/soynatan),\nor send me an email to [natancalzolari@gmail.com](mailto:natancalzolari@gmail.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoynatan%2Fdjango-easy-audit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoynatan%2Fdjango-easy-audit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoynatan%2Fdjango-easy-audit/lists"}