Community Apps
Admin Portal
Admin Actions
Table List Action

Table List Action

Table List Action
superapp/apps/<app_name>/admin.py
import unfold
from django.contrib import admin
from django_superapp.helpers import SuperAppModelAdmin
from django_superapp.sites import superapp_admin_site
from django.shortcuts import redirect
from django.utils.translation import gettext_lazy as _
from django.urls import reverse_lazy
from .models import SampleModel
 
@admin.register(SampleModel, site=superapp_admin_site)
class SampleModelAdmin(SuperAppModelAdmin):
    actions_list = [
        "sample_list_action",
    ]
 
    @unfold.decorators.action(description=_("My List action title here"))
    def sample_list_action(self, request):
        # Implement your logic here, for eg.
        sample = SampleModel.objects.all()
        return redirect(
            reverse_lazy("admin:app_samplemodel_changelist")
        )

Useful Resources