I have a Model Reader with ModelChoiceField
favourite_book which is a Foreign key. It is a DropDown menu and user can choose one from 40.000 possible options (records in the database).
There is a problem when editing this Model object and this specific field because DropDown is being populated with all the records from the database which takes too much time and memory. So, I have to find a way to somehow render this field with a matching option (that user has previously selected and saved in DB) alone and not with thousands of other options. I tried:
readerForm.fields['books'].initial = Books.objects.get(id=url)
but initial
doesn't work with bound forms.
I have $.ajax request that will later filter those 40.000 options based on input so user can choose some other option if needed.