I’m doing a quite a lot of work with django admin views on a project, and I’m wishing I had a diagram to refer to understand how a django admin page is created, in terms of when queries are made for each inline that is show on a page.
Does such a thing exist?
I’m thinking specifically about when get_queryset(), get_context_data() might be called, on the main model form, and then for any inlines, and so on.
I’m happy to have a go, as I’m sure I’ll need to come back to it in future, before I start, does this exist anywhere?
Hey Chris, replying here for other people who land here looking for the same.
Your best bet would be to print something suggestive within each method of the classes BaseModelAdmin & ModelAdmin, you can find them under site-packages/django/contrib/admin/options.py
This is what I got, but keep in mind that this is the general order, not all methods will be executed for every action in the admin interface.
Create a virtual environment with venv and go to the options.py file in the above mentioned path.
At the beginning of each method, type the print statement.