Load a select list when selecting another select
You have to follow this steps
Javascript

Bind a on change event to your Department select . 
If the select changes you get the value selected.
When you get the value, you have to send it to the server through an AJAX request.

Flask

Implement a method that reads the value and loads the associated Subdepartments.
Send a JSON response to the view with your Subdepartments

Javascript

In your AJAX request implement a success function. This function by default has as first parameter the data received from the server. Loop over them and append them to the wished select.
I have a Flask-admin application and I have a class with a "Department" and a "Subdepartment" fields.
In the create form, I want that when a Department is selected, the Subdepartment select automatically loads all the corresponding subdepartments.
In the database, I have a "department" table and a "sub_department" table that was a foreign key "department_id".
Any clues on how I could achieve that?
Thanks in advance.