Is it possible to set Flask Debug Toolbar to show insert queries?
Related
When user open some Django view there is option to choose what data to load from postgres DB. After that click submit and process is started. But when data is fetched and in the same view pressed reload, then all process starts from begining. Fetched time is about ~10min (best solution to fetched once by opening view and after that just manupulate with data without fetced each reloading)
I want to load data once or by button. But how to implement that i don't understand.
The easier approach is to do this with two pages:
First page: User can choose to load the data
Second page: Loads the data and shows it
If you want to do this on the same page you normally put a div on your page where the data should be loaded and then you need to use Javascript / AJAX to load and update your current page (or a part of it) based on user input like a clicked button.
There are multiple ways to implement this. Here are some examples:
HTMX - Click to load
JQuery - load div on button click
Pure Javascript
I would recommend HTMX, because it allows you to do this without having to write any JavaScript and it works great together with Django templates.
How can I profile a query and find where it is triggered to optimize it? I'm trying to use django toolbar but it doesn't show which function is triggering the query so I don't know where to fix.
You can go to the function that is calling the query by clicking on the plus on the left side of the query, using django debug_toolbar
I tried to use jquery chosen in django admin and it is not showing dropdown after implementing. With some debug I can confirm that the dropdown is there but not showing due to some css issue.
Any help ?
It is bit complicated so I hope that explain this properly.
I have app which is created within new Page in admin site. In that app I have also drop-down list with my installed apps like on picture.
drop-down of installed apps in new Page
I need someway to add models of selected app dynamicaly by add button at the end of this Page. So if I select app, with add button add model of app below page content, next select second app and add model below app added before. So at the end I will have filled Page with models of apps that I added.
Adding functionality like on this picture or with some add button or add button next to drop-down.
desired functionality
I dont have so much experiences in Django that I can make it self right now. I know that this is possible but I need help of you that you are Django Pro. I really need to make this done.
I want want to examine what django does with databse when I execute some statement with a django model
For instance
Group.members.all()
with manage.py shell.
Is there any way of doing this?
You can use the Django Debug Toolbar.
Introducing the Django Debug Toolbar
django-debug-toolbar (github)
print Group.members.all().query