Thanks for the second pair of eyes! I knew of course that the
`initial` keyword argument worked in my other views, but I doubted
myself. Surprising how many really lame mistakes you can make even
after a couple years of using Django every day!
Tim
On Sun, Oct 17, 2010 at 08:38, Tim Valenta <tonights...@gmail.com> wrote:
>> The only thing I can think of is that the choices for the field are
>> not being set correctly to start with - in the bit where you write
>> `(choices=[yada yada]`, what is 'yada yada'? Obviously, this must
>> contain *all* possible values for the codes across all responses, so
>> that the relevant ones can be selected for each item in the formset.
>
> I had shortened it because it was a gross little bit of code which
> effectively takes a queryset of another model and turns them into a
> customized "choice" strings. The result is just a giant tuple of (id,
> "name") pairs, where the `id` is the value I'm interested in injecting
> into the `codes` field. You are right about it needing to contains
> *all* possible codes.
>
> Did your test work for just `extra` forms, or did it also work out for
> existing instances? The part that kills me as I test is that I have
> poked around in the field object after I try to set the `initial`
> values, and my inserted ids are there among the other initial values
> from the instance value, yet `codes` would just not show up on my the
> form.
>
> If it works for you, then I really need to break this down and examine
> more contextual details!
>
> Thanks for the input.
>
I had shortened it because it was a gross little bit of code which