Reduce Discovery django admin loading times
Lately the PC team has seen Discovery taking a lot of time to load, specially when it comes to course run pages such as https://discovery.edx.org/admin/course_metadata/courserun/21473/change/
We believe it might be due to the fact that each time we open one of these, the page has to load all of the Staff that's on our database.
Could you take a look and see if there would be a way to reduce the loading time? This is becoming quite a time-consuming process for PCs, especially given that we use Discovery regularly.
Steps to Reproduce
Confirmed! Thank you all so much for your work on this!
It’s looking much much better (takes about 4 seconds to load). Thank you so much! I’ll check in with the rest of the team to confirm that Discovery is loading faster for them too.
Uzair has made page render optimization to 5 fields as mentioned ^
Can you please review and confirm if we are good with this update and page loads are promising now?
Lately the PC team has seen Discovery taking a lot of time to load, specially when it comes to course run pages.
This was happening because of the fact that django-admin needs to fetch all of the related data to populate admin page(provided above) for each course_run.In order to optimize the page load time, there was a need to fetch only relevant data.During the discovery, following fields are identified which would be fetched only on-demand:
draft_version in Inline Seat Model.
upgrade_deadline in Inline Seat Model.
'Transcript Languages' list.
'Video Translation Languages` list.
draft_version and currency fields inside Inline Seat Model are added to raw_id_fields.Now, they would be loaded only on demand.
A custom widget is added to the CourseRunAdmin which will give suggestions as per the input of three characters and load only on selection.
Moved it back to ready for dev to optimize staff and other fields that we have discussed in our check-in call.
Once you make these changes please comment here what different approaches have you taken to improve this load time including the one that you have already done.