In Django I would like to have a form with 2 submit button options. "save & home" and "save & next".
Any thoughts how I can identify which submit button was clicked in my view?
I'm fairly new to programming/working with forms and appreciate the feedback.
Form
<form action="{% url 'price_assessment_section_1' component.id %}" method="post"> {% csrf_token %}
 {{ form.s1_q5_resin_type }}
 <!-- FORM SUBMIT BUTTONS-->
 <button type="submit" > Save&Home</button>
 <button type="submit" > Save&Next</button>
</form> <!-- end form-->
View
@login_required
def price_assessment_section_1(request, component_id):
    component = Component.objects.get(id=component_id)
    if request.method == 'POST':
        form = PriceAssessmentSection1(request.POST)
                # if "save & home" go to: return HttpResponseRedirect(reverse('portal_home'))
                # if "save & next" go to: return HttpResponseRedirect(reverse('portal_sec2'))
    form = PriceAssessmentSection1()
    return render(request, 'portal/price_assessment_section_1.html', {'form': form, 'component':component})
 
     
     
    