1👍
✅
The declaration of a class as well as its fields is interpreted at import time, so does the initialization of the choices
value.
What you can do, is define __init__
function for SchedulerProfileForm
where you initialize locations field by calling get_tree_data()
inside.
EDIT:
Or, inherit from MultipleChoiceField
and redefine __init__
there.
Source:stackexchange.com