My class:
from django.contrib.admin.views.main import ChangeList
class MyChangeList(ChangeList):
def __init__(self, *args):
...
def get_query_set(self):
...
I added logs in both __init__ and get_query_set and I have noticed that the log output in the latter gets printed out (but none for the one in __init__. Is this possible ?
The
__init__function can call arbitrary methods itself, and construction of objects in Python can also be complicated with__new__, so make sure both outputs refer to the same object (for example, by includingid(self)in the output).To find out who called
get_query_set, you can usetraceback.print_stack: