Re: Set formfield.initial when created using modelformset_factory

2018-05-24 Thread Fabio Caritas Barrionuevo da Luz
try https://django-autocomplete-light.readthedocs.io/en/master/ Em quarta-feira, 23 de maio de 2018 15:58:20 UTC-3, Brock Hallenbeck escreveu: > > Thanks Collin, that does help. > > I guess I am going to have to take a fundamentally different approach to > accomplish what I want. > > I have att

Re: Set formfield.initial when created using modelformset_factory

2018-05-23 Thread Brock Hallenbeck
Thanks Collin, that does help. I guess I am going to have to take a fundamentally different approach to accomplish what I want. I have attempted to make an AJAX solution for foreign key dropdowns with >1000 options by creating a subclass of ModelChoiceField. By also subclassing its iterator I

Re: Set formfield.initial when created using modelformset_factory

2018-05-23 Thread Collin Anderson
Hi Brock, Yes, that's the intended behavior, and you can see the same behavior on a regular form, without using formsets, which might make it a little more clear what's going on: class MyForm(forms.Form): name = forms.CharField() form = MyForm(initial={'name': 'test'}) form.initial #yields

Set formfield.initial when created using modelformset_factory

2018-05-23 Thread Brock Hallenbeck
When creating a formset using modelformset_factory and passing in a list of dictionaries to use as initial values, those values can be retrieved from the relevant form, and the relevant boundfield on that form. However the formfield class itself has no knowledge of that initial data. Is this int