I’m going through the Django book and I’m currently on chapter 10. I’m having a problem understanding the third line in this fragment of code:
class DahlBookManager(models.Manager):
def get_query_set(self):
return super(DahlBookManager, self).get_query_set().filter(author='Roald Dahl')
I understand that this custom manager instance is overriding the superclass’ get_query_set method, but why is the super call passing in both DahlBookManager as well as self? Aren’t self and DahlBookManager the same thing?
This is about the builtin Super() function in Python.
You can get a reference here: http://docs.python.org/library/functions.html