Skip to content

Commit d9fccc9

Browse files
authored
docs: improved simple history installation guide (#1038)
1 parent bec3555 commit d9fccc9

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed
Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,40 @@
11
---
22
title: django-simple-history
33
order: 0
4-
description: Integration with django-simple-history.
4+
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.
55
---
66

77
# django-simple-history
88

9-
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.
9+
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.
10+
11+
```python
12+
# settings.py
13+
14+
INSTALLED_APPS = [
15+
"unfold",
16+
# ...
17+
"unfold.contrib.simple_history",
18+
# ...
19+
"simple_history",
20+
]
21+
```
22+
23+
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`.
24+
25+
```python
26+
# admin.py
27+
28+
from django.contrib import admin
29+
from django.contrib.auth import get_user_model
30+
31+
from simple_history.admin import SimpleHistoryAdmin
32+
from unfold.admin import ModelAdmin
33+
34+
User = get_user_model()
35+
36+
37+
@admin.register(User)
38+
class UserAdmin(SimpleHistoryAdmin, ModelAdmin):
39+
pass
40+
```

0 commit comments

Comments
 (0)