views:

247

answers:

2

I would like to override response_change in a ModelAdmin in order to update a field in the parent window. After doing the update, I'd like to give control back to the overriden response_change.

A simplified version of what I have tried is:

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

But I get an AttributeError - 'NoneType' object has no attribute 'has_header'. Maybe, I'm not using super properly...?

A: 

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
+3  A: 

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

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