Re: Creating 2 linked models from one page

2006-08-03 Thread limodou
On 8/4/06, Ian Clelland <[EMAIL PROTECTED]> wrote: > > On 8/3/06, cyberco <[EMAIL PROTECTED]> wrote: > > > > OK, but what to do with the following in case of 2 models: > > > > In the past, I've made a custom manipulator in situations like this. > Something like this (WARNING: Untested code ahead!)

Re: Creating 2 linked models from one page

2006-08-03 Thread Ian Clelland
On 8/3/06, cyberco <[EMAIL PROTECTED]> wrote: > > OK, but what to do with the following in case of 2 models: > In the past, I've made a custom manipulator in situations like this. Something like this (WARNING: Untested code ahead!) might work for you: class CustomManipulator(forms.manipulator):

Re: Creating 2 linked models from one page

2006-08-03 Thread cyberco
OK, but what to do with the following in case of 2 models: === new_data = request.POST.copy() errors = manipulator.get_validation_errors(new_data) if not errors: manipulator.do_html2python(new_data) == The complete method is: === def new(request): manipulato

Re: Creating 2 linked models from one page

2006-08-03 Thread limodou
On 8/3/06, cyberco <[EMAIL PROTECTED]> wrote: > > Yes, but I want only one 'submit' button on the html page. This means > that the POST data goes to one 'view' method. How can I first create an > instance of A and then an instance of B (with A's id) with the same > POST data? > > You can put two m

Re: Creating 2 linked models from one page

2006-08-03 Thread cyberco
Yes, but I want only one 'submit' button on the html page. This means that the POST data goes to one 'view' method. How can I first create an instance of A and then an instance of B (with A's id) with the same POST data? --~--~-~--~~~---~--~~ You received this mes

Re: Creating 2 linked models from one page

2006-08-03 Thread limodou
On 8/3/06, cyberco <[EMAIL PROTECTED]> wrote: > > I want to enable users to fill out two forms (textareas) on one page, > where each form creates a new instance of a model/class. I have the 2 > following models: > > > class A(models.Model): > text = models.TextField()

Creating 2 linked models from one page

2006-08-03 Thread cyberco
I want to enable users to fill out two forms (textareas) on one page, where each form creates a new instance of a model/class. I have the 2 following models: class A(models.Model): text = models.TextField() class B(models.Model): a = models.ForeignKey(A) text