Re: How to create multipage forms with different models

2020-03-03 Thread victor awakan
Thanks Naveen, I have try this code but when I clicked saved, the views redirect but no post was showing in the list view. def new_rental(request, pk):rentalproperty = get_object_or_404(RentalProperty, pk=pk)user = UserModel.objects.first() if request.method == 'POST':form =

Re: How to create multipage forms with different models

2020-03-03 Thread Naveen Arora
Each form field has an id to be identified at back end. So just select the relevant field create a model object using the same and save it. Similarly do for the other. You can try for once share the code here if you are unsuccessfull, i will help you with the code part then. Cheers On Tuesday

Re: How to create multipage forms with different models

2020-03-03 Thread victor awakan
@suraj Could you show by example? I have tried one way which I posted the dpaste link with my first post but it doesn’t work. I.e when I clicked submit I don’t get any new post in the template. Thanks On Tue 3. Mar 2020 at 11.44, Suraj Thapa FC wrote: > There can be only one view for one page...

Re: How to create multipage forms with different models

2020-03-03 Thread Suraj Thapa FC
There can be only one view for one page You have to implement both in same view On Tue, 3 Mar 2020, 2:58 pm victor awakan, wrote: > What I meant was I want one form to be saved in one model and the second > form to be saved in another model. I did that using form-tools but I want > to learn

Re: How to create multipage forms with different models

2020-03-03 Thread victor awakan
What I meant was I want one form to be saved in one model and the second form to be saved in another model. I did that using form-tools but I want to learn how to do it using function based views. Thanks. On Tuesday, March 3, 2020 at 11:19:40 AM UTC+2, Naveen Arora wrote: > > Hi, >  > What prob

Re: How to create multipage forms with different models

2020-03-03 Thread Naveen Arora
Hi,  What problem you are facing ? A form can be sent to any template using its object and context dictionary. "Split the form to separate templates" ? This seems unusual, create different forms if you want to use more templates. Cheers :) Naveen Arora  On Monday, 2 March 2020 18:08:44 UTC

How to create multipage forms with different models

2020-03-02 Thread victor awakan
I am a building a small project in Django. I am able to create two or more forms in a template but now, I want to split the form to separate templates with each form belong to different models. How can I achieve this? Here is a link to dpaste with the multiple forms in a template I created: htt