Re: Two models one form, or use generic CreateView

2021-01-07 Thread _M_A_Y_A_N_K_
You could use InlineFormSet, which is designed specially to handle such problems. Refer to the documentations here https://docs.djangoproject.com/en/3.1/topics/forms/modelforms/#inline-formsets Here you could provide the primary model (in your case it will be CUstomUser), and the secondary model

Re: Two models one form, or use generic CreateView

2021-01-07 Thread Farai M
Your code is fine but you will need to preload your form with the customer which you want this can be done in the get method of that create view.Read more about use of DjangoModel form https://docs.djangoproject.com/en/3.1/topics/forms/modelforms/ Then override the get() method and respond with t

Re: Two models one form, or use generic CreateView

2020-06-09 Thread chaitanya orakala
Hi Sha, I like your template CSS styling and formatting. Could you please post your index HTML and CSS style if you don't mind. Thanks in Advance On Tue, Jun 9, 2020 at 4:18 PM Yamen Gamal Eldin wrote: > It's pretty straight forward, just search about overload save function for > update view, th

Re: Two models one form, or use generic CreateView

2020-06-09 Thread Yamen Gamal Eldin
It's pretty straight forward, just search about overload save function for update view, that will make u create a save function in your form, do the necessary actions on your instance, and voula Le mar. 9 juin 2020 à 16:24, The Sha a écrit : > Ok intressant, i cant find any good exemplen. Thank

Re: Two models one form, or use generic CreateView

2020-06-09 Thread The Sha
Ok intressant, i cant find any good exemplen. Thank you for the reply. Im new to django can you maybe be more specific with som examples or point me in the right direktion? thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscri

Re: Two models one form, or use generic CreateView

2020-06-09 Thread Yamen Gamal Eldin
There's many ways to solve it. My favorable approach will be to override the save method in the targeted form. Le mar. 9 juin 2020 à 14:35, The Sha a écrit : > Hi > > I hava a problem in django, i have to models one is a CustomUser Model and > the other is a Address model. > > The problem is tha

Two models one form, or use generic CreateView

2020-06-09 Thread The Sha
Hi I hava a problem in django, i have to models one is a CustomUser Model and the other is a Address model. The problem is that when i create a generic CreateView for the Address model and use a pk: url the address form wont get the instance of the users PK for adding a new address. my mode