Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add admin for softdeleted items. #6

Open
jorgii opened this issue Apr 30, 2020 · 0 comments
Open

Feature request: Add admin for softdeleted items. #6

jorgii opened this issue Apr 30, 2020 · 0 comments

Comments

@jorgii
Copy link

jorgii commented Apr 30, 2020

Add a SoftDeleteAdmin class that lists even soft deleted items. That could be useful to people that need to restore soft deleted items via the admin panel.

The code should be pretty simple:

from django.contrib import admin

class SoftDeleteAdmin(admin.ModelAdmin):
    def get_queryset(self, request):
        qs = self.model.raw_objects.get_queryset()
        ordering = self.get_ordering(request)
        if ordering:
            qs = qs.order_by(*ordering)
        return qs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant