Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Enforce the POST method on VAT rates fetching
NyanKiyoshi232f5ecb0019
diff --git a/saleor/dashboard/taxes/views.py b/saleor/dashboard/taxes/views.pyindex 31e52987b7..9eef38f8bc 100644--- a/saleor/dashboard/taxes/views.py+++ b/saleor/dashboard/taxes/views.py@@ -8,6 +8,7 @@ from django.core.management import call_commandfrom django.shortcuts import get_object_or_404, redirectfrom django.template.response import TemplateResponsefrom django.utils.translation import pgettext_lazy+from django.views.decorators.http import require_POSTfrom django_countries.fields import Countryfrom django_prices_vatlayer.models import VAT@@ -61,6 +62,7 @@ def configure_taxes(request):@staff_member_required+@require_POST@permission_required('site.manage_settings')def fetch_tax_rates(request):try:diff --git a/templates/dashboard/taxes/list.html b/templates/dashboard/taxes/list.htmlindex f539c3aef4..70e7bda19e 100644--- a/templates/dashboard/taxes/list.html+++ b/templates/dashboard/taxes/list.html@@ -121,9 +121,12 @@<a class="btn-flat waves-effect" href="{% url 'dashboard:configure-taxes' %}">{% trans "Configure taxes" context "Site settings configure taxes action" %}</a>- <a class="btn-flat waves-effect load-action" href="{% url 'dashboard:fetch-tax-rates' %}">- {% trans "Fetch tax rates" context "Site settings fetch tax rates action" %}- </a>+ <form method="POST" action="{% url 'dashboard:fetch-tax-rates' %}" style="display: inline">+ <button type="submit" class="btn-flat waves-effect">+ {% csrf_token %}+ {% trans "Fetch tax rates" context "Site settings fetch tax rates action" %}+ </button>+ </form></div></div></div>