[Django]-How to override and call super for response_change or response_add in django admin

16👍

You need to actually return the result of the call to super().

return super(MyModelAdmin, self).response_change(request, obj)

0👍

Maybe you could add a more detailed stacktrace?

Where does the Error occur? Do you create a response? Otherwise get_response might implicitly return None therefor the error.

👤jitter

0👍

You need to return "super().response_change(request, obj)" as shown below:

class MyModelAdmin(admin.ModelAdmin):
    def response_change(self, request, obj):
        // perfom my actions
        return super().response_change(request, obj) # Here

Leave a comment