On Dec 29, 2007 4:39 AM, David Larlet <[EMAIL PROTECTED]> wrote: > > Thanks for those useful tricks. Here are some typo corrections, hope > it helps: > > > [4]: http://code.djangoproject.com/wiki/CookBookNewFormsDynamicFields > > [4]: http://code.djangoproject.com/wiki/CookBookNewFormsFieldOrdering > Whoops!
> In DynamicFields, you forgot to add 'self' as first argument of > __init__. > In the same function you use range(len(iterable)) which is not really > pythonic, I prefer this solution: > > for i, question in enumerate(questions): > self.fields['question_%d' % i] = > forms.ChoiceField(label=questions, ...) > Thanks for pointing this out. I didn't even know about the enumerate function! Both fixed. Todd --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---