Multiple formsets in a view

2011-05-22 Thread ekms
Hello, in my view, I create dinamically multiple formsets, and I put a dinamic prefix to all of them (ex, formset1, formset2, ...), then I pack all the formsets in a list and pass it to the template. Later, how I can retrieve all the formsets from request.POST? I know that I've to do something li

Re: Why is request.session.flush() deleting my objects from DB?

2011-05-14 Thread ekms
ok, I spot the bug. In one of these models, I have a foreign key to Session model. So, when I do session.flush(), on cascade deleted all the related models. thank you for your time. On May 14, 3:15 pm, ekms wrote: > I debugged it step by step and the data dissapears from DB in the line &

Re: Why is request.session.flush() deleting my objects from DB?

2011-05-14 Thread ekms
I debugged it step by step and the data dissapears from DB in the line of session.flush() The data are three models that I created, and instances of these models are saved in the form. The difference between these models and others saved but not deleted by flush(), is that these 3 models have fore

Why is request.session.flush() deleting my objects from DB?

2011-05-13 Thread ekms
Hello, I have a form where I want that every time that a user want to send it, he has to login. So, before the view that render the form, I made another view where I do request.session.flush() and after this, I redirect to the form (the view of the form has @login_required). User completes the fo

Re: bound form with ModelChoiceField

2011-04-22 Thread ekms
my form don't map closely to a model. Thanks. On 22 abr, 07:09, Andy McKay wrote: > On 2011-04-21, at 4:07 PM, ekms wrote: > > > So, what is the correct way to create a bound form of > > ModelChoiceField? I  could store request.POST or myform.data instead > > of m

bound form with ModelChoiceField

2011-04-21 Thread ekms
Hello, I have a form with a ModelChoiceField, and when I want to create a new bound form using the first form cleaned_data (that I stored in a session before), I get an error when rendering the template ("Caught TypeError while rendering: int() argument must be a string or a number"). This is beca