0

admin is instance. I want to do something to instance like decorator.

class CodeInClass(admin.AdminSite):
    def get_app_list(self, request):
        all_list = super().get_app_list(request)
        # reorder the app list as you like
        return all_list


def get_app_list(request):
    all_list = super().get_app_list_old(request)
    # dosomething()
    return all_list

admin.site.get_app_list_old = admin.site.get_app_list
admin.site.get_app_list = get_app_list

Get error:

RuntimeError at /admin/
super(): __class__ cell not found
wgf4242
  • 775
  • 2
  • 11
  • 23

0 Answers0