Re: form with loop over fields?
i would need something like:
jan feb mar apr may
2007 [...] [...] [...] [...] [...]
2008 [...] [...] [...] [...] [...]
2008 [...] [...] [...] [...] [...]
i dont think a formset would be the right way to go in this case (but
maybe im wrong).
the values of the form should be stored and re-edited when necessary.
that would be only a part of the whole thing, i implemented the rest of
the form through a model and generating the form trough it.
David De La Harpe Golden wrote:
> andreas schmid wrote:
>
>> hi ,
>>
>> i need to create an input form with a input field for every month for
>> lets say 10 years.
>> so the form has 10*12 = 120 exact same input fields.
>>
>>
>
> Do you mean tabular sort of form?
>
> gross deductible
> 2009-11-11 [...] [...]
> 2009-11-10 [...] [...]
> sort of thing?
>
>
>> is there a way to define the field only once or maybe define a year with
>> 12 fields and loop over it to avoid having a huge model?
>>
>>
>
> There are certainly ways of doing it directly as one django form object
> (python is quite dynamic), but you could maybe look at the FormSet
> infrastructure - one form per month in a formset.
>
> http://docs.djangoproject.com/en/dev/topics/forms/formsets/
>
> An important thing to bear in mind when working with django forms is
> that 1 django form doesn't have to map to 1 html form. You can use N
> django form objects in 1 html form, separating them with a prefix.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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 django-users+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home