This is my class structure:
class MyMixin(object):
def __init__(self, **kwargs):
super(MyMixin, self).__init__(**kwargs)
class MyBaseView(MyMixin, TemplateView):
def __init__(self, **kwargs):
print 'MyBaseView init'
super(MyBaseView, self).__init__(**kwargs)
class MyCommonView(MyBaseView):
def __init__(self, **kwargs):
print 'MyCommonView init'
super(MyCommonView, self).__init__(**kwargs)
class MyView(MyCommonView):
def __init__(self, **kwargs):
print 'MyView init'
super(MyView, self).__init__(**kwargs)
In urls.py:
url(r'^some/url/$', MyView.as_view())
Also, there are some instance variables defined in each constructor. I didn't write them here because I don't think they are relevant.
Result... MyView and MyCommonView init messages get printed, but MyBaseView doesn't. So, MyBaseView's constructor never gets called. I know for a fact the constructor isn't called because I see some things are not initialized properly, prints are here just to demonstrate they are not called.
Why? What could be causing this? How to resolve it?
Thanks.