Just wanted to clarify -- returning in a loop is an okay thing to do. It saves you from wasting cycles in a given loop. I suppose you could simply "break" out of it as well. I'm sure that could be a matter of opinion.
But glad to hear you fixed your specific problem :) On Wed, Nov 9, 2011 at 4:13 PM, bentzy <[email protected]> wrote: > Solved. > > It's not recommended to return while in a loop > :-X > > On Nov 9, 10:30 pm, bentzy <[email protected]> wrote: > > Hi, > > > > I'm trying to run the example at documentation about formsets(https:// > > docs.djangoproject.com/en/1.2/topics/forms/formsets/) > > > > It basically works, but the "extra" parameter doesn't: > > > > Following that example, I wrote: > > > > def fs(request): > > ArticleFormSet = formset_factory(ArticleForm, extra=5 ) > > formset = ArticleFormSet() > > print 'length:' + (str)(len(formset.forms)) > > > > for form in formset.forms: > > print form.as_table() > > return render_to_response('fs.html', {'formset': formset },) > > > > And I get at output: > > > > length:5 > > <tr><th><label for="id_form-0-title">Title:</label></th><td><input > > type="text" name="form-0-title" id="id_form-0-title" /></td></tr> > > <tr><th><label for="id_form-0-pub_date">Pub date:</label></ > > th><td><input type="text" name="form-0-pub_date" id="id_form-0- > > pub_date" /></td></tr> > > [09/Nov/2011 22:26:35] "GET /formsettest/ HTTP/1.1" 200 27 > > > > ONLY one form (expected five :-( ) > > > > Any help will be really appreciated! > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > 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. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. 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.

