ok

Dios L@s Bendiga

Saludos,



[image: --]

daniel.bojorge
[image: http://]about.me/daniel.bojorge
<http://about.me/daniel.bojorge?promo=email_sig>
 Mi Blog <http://debsconsultores.blogspot.com>
Nicaragua

"Si ustedes permanecen unidos a mí, y si permanecen fieles a mis
enseñanzas, pidan lo que quieran y se les dará.
(Juan 15:7 DHH)
Bendito el varón que se fía en el SEÑOR, y cuya confianza es el SEÑOR.
(Jeremías 17:7 RV2000)



El sáb., 13 oct. 2018 a las 9:16, Joel Mathew (<j...@joel.su>) escribió:

> Could you kindly stop spamming your course details over over this
> discussion group. It's not useful to the majority of us English speaking
> people.
>
>
>
>
> On Sat, 13 Oct 2018 at 20:41, Daniel Bojorge (Foros) <debs.fo...@gmail.com>
> wrote:
>
>> Take a look to my course (in spanish) and go to the last CRUD, there I do
>> a Master-Detail form, the detail form are many models
>>
>>  DJANGO 2.1  https://goo.gl/oeT5Sx
>>
>> El viernes, 7 de septiembre de 2018, 4:43:11 (UTC-6), Django Lover
>> escribió:
>>>
>>>
>>> I have one page, which I have to show three model form and three
>>> different submit button for each.
>>>
>>> My question is how I can save these three form individually?
>>>
>>> FOLLOWING IS CODE:-
>>>
>>> **form.py**
>>>
>>>
>>> class UserTaxesMultiForm(MultiModelForm):
>>>    form_classes = {
>>>        'user_tax_form': MyForm,
>>>        'user_discount_form': DiscountForm,
>>>        'user_shiping_form': ShipmentForm,
>>>    }
>>>
>>> *Note- myForm, DiscountForm, ShipmentForm are model forms. like
>>> following-*
>>>
>>> class MyForm(forms.ModelForm):
>>>        prefix = 'tax'
>>>        class Meta:
>>>            model = StUserTaxDetails
>>>            fields = ('tax_name', 'tax_rate')
>>>
>>>        tax_name = forms.CharField(max_length=10,
>>>         widget=forms.TextInput(),
>>>         required=True, label="tax name")
>>>
>>>         tax_rate = forms.FloatField(required=True,  label="tax rate")
>>>
>>>
>>>         error_messages  = {
>>>            'required': _('fields are required.'),
>>>        }
>>>
>>>         def clean_title(self):
>>>            return self.cleaned_data['tax_name']
>>>
>>>         def clean(self):
>>>            tax_name = self.cleaned_data.get('tax_name')
>>>            tax_rate = self.cleaned_data.get('tax_rate')
>>>
>>>             if not tax_name and not tax_rate:
>>>                raise forms.ValidationError(
>>>                    self.error_messages['required'],
>>>                    code='required',
>>>                )
>>>            return self.cleaned_data
>>>
>>> **view.py**
>>> class AddTaxView(LoginRequiredMixin, CreateView):
>>>    template_name = 'invoices/add_tax.html'
>>>    form_class = UserTaxesMultiForm
>>>    success_url = '/add/tax/'
>>>
>>>    *{WHAT IS THE CODE HERE FOR THE POST METHOD TO SAVE DATA ACORDING
>>> DIFFRENT FORM SUBMIT} *
>>>
>>>
>>>
>>>
>>> **HTML**
>>>
>>>
>>>
>>> <form method="POST">
>>> {% form.user_tax_form%}
>>>
>>> <input type="submit" value="Submit" />
>>> </form>
>>>
>>> <form method="POST">
>>> {% form.user_discount_form%}
>>>
>>> <input type="submit" value="Submit" />
>>> </form>
>>>
>>> <form method="POST">
>>> {% form.user_shiping_form%}
>>>
>>> <input type="submit" value="Submit" />
>>> </form>
>>>
>>> PLEASE HELP
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/6643b26e-d00d-438d-9d24-d383c857fada%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/6643b26e-d00d-438d-9d24-d383c857fada%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAA%3Diw_-QFgL1DEZMmYMzpZRUcr5aY%2BGCBv_dJJB%3DdgyRyJJwQQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAA%3Diw_-QFgL1DEZMmYMzpZRUcr5aY%2BGCBv_dJJB%3DdgyRyJJwQQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMQeQjaaezvL-BdyAwt9rmnq11CsoxwC05Bcr5NPf8N%2BfofV_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to