Re: modelformset_factory, initial, and queryset

2010-10-17 Thread Tim Valenta
> 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 o

Re: modelformset_factory, initial, and queryset

2010-10-17 Thread Tim Valenta
Sir, I just re-examined my code and realized that the integers I was plugging into `initial` was the wrong value, semantically speaking. IDs from the wrong model were being used for initial values... Simplifying my example for this explanation helped me see that pretty quickly when I pulled my code

Re: modelformset_factory, initial, and queryset

2010-10-17 Thread Daniel Roseman
On Oct 16, 4:36 am, Tim Valenta wrote: > I have a model like such: >     class Response(models.Model): >         raw_text = models.TextField() >         respondent = models.ForeignKey('auth.User') > > Response has a related model attached to it: >     class Code(models.Model): >         response =

Re: modelformset_factory, initial, and queryset

2010-10-15 Thread Tim Valenta
I have a model like such: class Response(models.Model): raw_text = models.TextField() respondent = models.ForeignKey('auth.User') Response has a related model attached to it: class Code(models.Model): response = models.ForeignKey(Response) coded_answer = mod

Re: modelformset_factory, initial, and queryset

2010-10-14 Thread Daniel Roseman
On Oct 14, 10:32 am, Tim Valenta wrote: > This is driving me mad, so I must ask the community, in hopes of a > workaround: > > I've got a simple formset of models on a page, generated by > modelformset_factory.  This particular page will never create forms-- > it only modifies existing ones.  Ther