{"id":21832919,"url":"https://github.com/null-none/django-logs","last_synced_at":"2026-05-14T20:32:11.551Z","repository":{"id":196593016,"uuid":"696467342","full_name":"null-none/django-logs","owner":"null-none","description":"Log for your Django models","archived":false,"fork":false,"pushed_at":"2024-01-05T13:23:17.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-13T10:26:12.915Z","etag":null,"topics":["audit","django","logs","orm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/null-none.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"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":"2023-09-25T19:56:39.000Z","updated_at":"2023-09-25T20:07:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c07d570-12f9-4233-96a7-f832608d94ac","html_url":"https://github.com/null-none/django-logs","commit_stats":null,"previous_names":["null-none/django-logs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/null-none/django-logs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/null-none%2Fdjango-logs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/null-none%2Fdjango-logs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/null-none%2Fdjango-logs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/null-none%2Fdjango-logs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/null-none","download_url":"https://codeload.github.com/null-none/django-logs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/null-none%2Fdjango-logs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33042138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","django","logs","orm"],"created_at":"2024-11-27T19:27:06.056Z","updated_at":"2026-05-14T20:32:11.534Z","avatar_url":"https://github.com/null-none.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"============================\ndjango-logs\n============================\n\nTracking changes to django models.\n\n\n* Model fields for keeping track of the user and session that created and modified a model instance.\n* Abstract model class with fields ``created_by`` and ``modified_by`` fields.\n* A model manager class that can automatically track changes made to a model in the database.\n\n\nQuickstart Guide\n===============================\n\nInstall it with pip from PyPi::\n\n    pip install django-logs\n\nAdd ``logs.middleware.UserLoggingMiddleware`` to your ``MIDDLEWARE_CLASSES``::\n\n\n    MIDDLEWARE_CLASSES = (\n        ...\n        'logs.middleware.UserLoggingMiddleware',\n    )\n\n\nTo just track who created or edited a model instance just make it inherit from ``AuthStampedModel``::\n\n\n    from logs.models import AuthStampedModel\n\n    class WarehouseEntry(AuthStampedModel):\n        product = models.ForeignKey(Product)\n        quantity = models.DecimalField(max_digits = 10, decimal_places = 2)\n\n\nThis will add 4 fields to the ``WarehouseEntry`` model:\n\n* ``created_by`` - A foreign key to the user that created the model instance.\n* ``created_with_session_key`` - Stores the session key with which the model instance was first created.\n* ``modified_by`` - A foreign key to the user that last saved a model instance.\n* ``modified_with_session_key`` - Stores the session key with which the model instance was last saved.\n\nIf you want to track full model change history you need to attach an ``AuditLog`` manager to the model::\n\n    from django.db import models\n    from logs.models.fields import LastUserField\n    from logs.models.managers import AuditLog\n\n\n    class ProductCategory(models.Model):\n        name = models.CharField(max_length=150, primary_key = True)\n        description = models.TextField()\n\n        logs = AuditLog()\n\n    class Product(models.Model):\n        name = models.CharField(max_length = 150)\n        description = models.TextField()\n        price = models.DecimalField(max_digits = 10, decimal_places = 2)\n        category = models.ForeignKey(ProductCategory)\n\n        logs = AuditLog()\n\nYou can then query the audit log::\n\n    In [2]: Product.logs.all()\n    Out[2]: [\u003cProductAuditLogEntry: Product: My widget changed at 2011-02-25 06:04:29.292363\u003e,\n            \u003cProductAuditLogEntry: Product: My widget changed at 2011-02-25 06:04:24.898991\u003e,\n            \u003cProductAuditLogEntry: Product: My Gadget super changed at 2011-02-25 06:04:15.448934\u003e,\n            \u003cProductAuditLogEntry: Product: My Gadget changed at 2011-02-25 06:04:06.566589\u003e,\n            \u003cProductAuditLogEntry: Product: My Gadget created at 2011-02-25 06:03:57.751222\u003e,\n            \u003cProductAuditLogEntry: Product: My widget created at 2011-02-25 06:03:42.027220\u003e]","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnull-none%2Fdjango-logs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnull-none%2Fdjango-logs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnull-none%2Fdjango-logs/lists"}