Skip to content

Commit

Permalink
docs: improved simple history installation guide
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasvinclav committed Feb 4, 2025
1 parent bec3555 commit 87a618c
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions docs/integrations/django-simple-history.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
---
title: django-simple-history
order: 0
description: Integration with django-simple-history.
description: Learn how to integrate django-simple-history with Django Unfold admin panel to track and display model history changes for seamless version control and change tracking.
---

# django-simple-history

To make this application work, add `unfold.contrib.simple_history` into `settings.py` in `INSTALLED_APPS` variable before right after `unfold`. This app should ensure that templates coming from django-simple-history are overridden by Unfold.
To make this application work, add `unfold.contrib.simple_history` to the `INSTALLED_APPS` variable in `settings.py`, placing it after `unfold` but before `simple_history`. This app ensures that templates from django-simple-history are overridden by Unfold.

```python
# settings.py

INSTALLED_APPS = [
"unfold",
# ...
"unfold.contrib.simple_history",
# ...
"simple_history",
]
```

Below you can find an example of how to use Unfold with django-simple-history. The important part is to inherit from `SimpleHistoryAdmin` and `unfold.adminModelAdmin`.

```python
# admin.py

from django.contrib import admin
from django.contrib.auth import get_user_model

from simple_history.admin import SimpleHistoryAdmin
from unfold.admin import ModelAdmin

User = get_user_model()


@admin.register(User)
class UserAdmin(SimpleHistoryAdmin, ModelAdmin):
pass
```

0 comments on commit 87a618c

Please sign in to comment.