In my views.py :
def addContact(request):
if request.method == 'POST':
return render(request, 'partials/contact-form-post.html')
return render(request, 'partials/contact-form.html')
My contact form parent page has this :
<form hx-post="{% url 'contact_form' %}" hx-target="this" hx-swap="innerHTML">
{% csrf_token %}
{% include "../partials/contact-form.html" %}
</form>
partials/contact-form-post.html :
Contact Added -
<button type="button" hx-get="{% url 'contact_form' %}">Add Another</button>
This works only 1.5 times - because the second time I try to POST (add contact) the {% csrf_token %}
is invalid - so how do I solve this ?