Skip to content

Commit 2c71785

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 a768673 commit 2c71785

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
@@ -283,3 +283,16 @@ def enforce_history_permissions(self):
283283
return getattr(
284284
settings, "SIMPLE_HISTORY_ENFORCE_HISTORY_MODEL_PERMISSIONS", False
285285
)
286+
287+
288+
class SimpleHistoryShowDeletedFilter(admin.SimpleListFilter):
289+
title = "Entries"
290+
parameter_name = "entries"
291+
292+
def lookups(self, request, model_admin):
293+
return (("deleted_only", "Only Deleted"),)
294+
295+
def queryset(self, request, queryset):
296+
if self.value():
297+
return queryset.model.history.filter(history_type="-").distinct()
298+
return queryset

0 commit comments

Comments
 (0)