Skip to content

Commit 6353514

Browse files
snps-msilvamjsir911
authored andcommitted
POC for #72
Note that if you are using any custom methods on the model for the admin display, you need to use a History Base class for this to work(#311).
1 parent b5eadd5 commit 6353514

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

simple_history/admin.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,16 @@ def enforce_history_permissions(self):
284284
return getattr(
285285
settings, "SIMPLE_HISTORY_ENFORCE_HISTORY_MODEL_PERMISSIONS", False
286286
)
287+
288+
289+
class SimpleHistoryShowDeletedFilter(admin.SimpleListFilter):
290+
title = "Entries"
291+
parameter_name = "entries"
292+
293+
def lookups(self, request, model_admin):
294+
return (("deleted_only", "Only Deleted"),)
295+
296+
def queryset(self, request, queryset):
297+
if self.value():
298+
return queryset.model.history.filter(history_type="-").distinct()
299+
return queryset

0 commit comments

Comments
 (0)