Add history tracking functionality using django-pghistory; implement views, templates, and middleware for event serialization and context management

This commit is contained in:
pacnpal
2025-02-09 09:52:19 -05:00
parent a148d34cf9
commit 7ecf43f1a4
14 changed files with 210 additions and 7 deletions

View File

@@ -29,6 +29,9 @@ INSTALLED_APPS = [
"django.contrib.staticfiles",
"django.contrib.sites",
"django.contrib.gis", # Add GeoDjango
"pghistory", # Add django-pghistory
"pgtrigger", # Required by django-pghistory
"history.apps.HistoryConfig", # History timeline app
"allauth",
"allauth.account",
"allauth.socialaccount",
@@ -65,6 +68,7 @@ MIDDLEWARE = [
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"core.middleware.setup_pghistory_context", # Add history context tracking
"allauth.account.middleware.AccountMiddleware",
"django.middleware.cache.FetchFromCacheMiddleware",
"simple_history.middleware.HistoryRequestMiddleware",

View File

@@ -52,6 +52,7 @@ urlpatterns = [
path("user/", accounts_views.user_redirect_view, name="user_redirect"),
# Moderation URLs - placed after other URLs but before static/media serving
path("moderation/", include("moderation.urls", namespace="moderation")),
path("history/", include("history.urls", namespace="history")),
path(
"env-settings/",
views***REMOVED***ironment_and_settings_view,