Skip to content

Commit

Permalink
Merge pull request #16 from uktrade/DST-209-db-historical-audit-trail
Browse files Browse the repository at this point in the history
DST-209: DB historical audit trail
  • Loading branch information
nahmed99 authored Feb 6, 2024
2 parents 9eef2fa + 94dfd7c commit 8c4b523
Show file tree
Hide file tree
Showing 6 changed files with 325 additions and 1 deletion.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ django-formtools = "*"
gevent = "*"
sentry-sdk = "*"
whitenoise = "*"
django-simple-history = "~=3.4.0"

[dev-packages]
black = "~=23.12"
Expand Down
28 changes: 28 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"crispy_forms",
"crispy_forms_gds",
"django_chunk_upload_handlers",
"simple_history",
]

INSTALLED_APPS = DJANGO_APPS + OUR_APPS + THIRD_PARTY_APPS
Expand All @@ -67,6 +68,7 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"simple_history.middleware.HistoryRequestMiddleware",
]

ROOT_URLCONF = "config.urls"
Expand Down
2 changes: 2 additions & 0 deletions report_a_breach/base_classes/models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import uuid

from django.db import models
from simple_history.models import HistoricalRecords


class BaseModel(models.Model):
id = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4)
created_at = models.DateTimeField(auto_now_add=True)
modified_at = models.DateTimeField(auto_now=True)
history = HistoricalRecords(inherit=True)

class Meta:
abstract = True
2 changes: 1 addition & 1 deletion report_a_breach/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.9 on 2024-02-05 13:43
# Generated by Django 4.2.9 on 2024-02-05 16:40

import uuid

Expand Down
Loading

0 comments on commit 8c4b523

Please sign in to comment.