You should be able to override any method in the superclass by creating a method with the same name in the subclass. The signature of the argument is not considered. For instance:
class A(object): def method(self, arg1): print "Method A", arg1 class B(A): def method(self): print "Method B" A().method(True)
In the case of get_unit_display (), you do not need to call super () at all if you want to change the displayed value, but if you want to use super (), make sure you call it using the correct signature, for example:
class A(models.Model): unit = models.IntegerField(choices=something) def get_unit_display(self, value): display = super(A, self).get_unit_display(value) if value > 1: display = display + "s" return display
Note that we pass the value of super () get_unit_display ().
source share