Added admin logentry #662
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.46) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 459 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.367
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #662"
general
weight: 0.35
Mogost
Summary
LogEntry(django_admin_log) table when values are modified via the constance admin interface./admin/constance/config/history/with a standard Django history table (date/time, user, action).Context / Why
LogEntryinfrastructure is the standard mechanism for this and is already used by every otherModelAdmin.What changed
constance/forms.pyConstanceForm.save()now returns a list of config field names that were actually modified (previously returnedNoneimplicitly). Backwards-compatible — callers that ignored the return value are unaffected.constance/admin.py_log_config_change(request, changed_fields): Creates aLogEntryusingLogEntry.objects.create()directly rather than the deprecatedlog_action()(deprecated in Django 5.0, removed in 6.0) orlog_actions()(requires a queryset, incompatible with the fakeConfigmodel). Uses Django's standard JSONchange_messageformat soLogEntry.get_change_message()renders correctly.changelist_view: After a successful save, creates aLogEntryonly if fields actually changed.history_view: New view that queriesLogEntryrecords filtered by theConfigcontent type. Includes pagination (100 per page) and permission checks. Modelled after Django's built-inModelAdmin.history_view.get_urls(): Addedhistory/route and a<object_id>/change/redirect route (so "Recent actions" sidebar links resolve instead of returningNone).Templates
change_list.html: Added "History" button using standard Djangoobject-toolsmarkup.config_history.html(new): History page template based on Django'sadmin/object_history.htmlwith constance-appropriate breadcrumbs (Home > Constance > Config > History).tests/test_admin.pytest_log_entry_created_on_change,test_no_log_entry_when_no_changes,test_history_view,test_history_view_empty,test_history_view_permission_denied,test_changelist_has_history_link,test_change_url_redirects_to_changelist.test_submitmock to match newsave()return type ([]instead ofNone).ContentType.objects.clear_cache()insetUpto prevent stale FK references across test transactions.How to test
DJANGO_SETTINGS_MODULE=tests.settings python3 -m pytest tests/test_admin.py -v— all 21 tests pass.DJANGO_SETTINGS_MODULE=tests.settings python3 -m pytest tests/ -v— full suite: 156 passed, 1 skipped (pre-existing).Notes
LogEntry.objects.create()directly, which avoids both the deprecatedlog_action()(Django 5.0+) andlog_actions()(requires a queryset, not available in Django 4.2). This is future-proof across all supported Django versions (4.2–5.2).