django multiple of same form one submit code example
Example 1: multiple form in one class djanog
class MultipleFormsDemoView(MultiFormsView):
template_name = "pages/cbv_multiple_forms.html"
form_classes = {'contact': ContactForm,
'subscription': SubscriptionForm,
}
success_urls = {
'contact': reverse_lazy('contact-form-redirect'),
'subscription': reverse_lazy('submission-form-redirect'),
}
def contact_form_valid(self, form):
'contact form processing goes in here'
def subscription_form_valid(self, form):
'subscription form processing goes in here'
Example 2: same form two submits
<input type="submit" formaction="example.php">
<button type="submit" formaction="mail.php"> Button</buttton>