Um bit confused about Django’s ModelAdmin section. In order to customized the context we must call the change_view method . I cannot understand in what way the method getting called by Admin Class. Is it an instance method? Can anyone give me an explanation. I have gone through the documentation as well but I was unable to get a clear view. Thank you in advance.
Um bit confused about Django’s ModelAdmin section. In order to customized the context we
Share
An instance method (as apposed to a static method) is one who’s result depends on the state of the specific object it’s called on. (A static method gives the same result for any object of it’s class).
Have a look at the
change_view()method indjango.contrib.admin.options.ModelAdmin. This method uses many properties of the object to produce a return.I guess, since you’re overiding it, you could rewrite it so that it was effectively a static method, but I’m pretty sure that would break stuff. You need to include a call to
super(MyModelAdmin, self).change_view().Maybe have a look at the python docs for more info on overriding methods.