prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  The fetch vat rates button should not be a GET method
  ### What I'm trying to achieve
  Not to allow GET methods to fetch vat rates.
  
  ### Steps to reproduce the problem
  1. Go to configuration -> Taxes ;
  2. The fetch tax rates button, is a GET button.
  
  ### What I expected to happen
  Get a POST instead of a GET, which is safer against attacks.
  
  ### Describe a proposed solution
  Drop the button link on the dashboard for a submit button or a modal.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `saleor/dashboard/taxes/views.py`
  Content:
  ```
  1 import logging
  2 
  3 from django.conf import settings
  4 from django.contrib import messages
  5 from django.contrib.auth.decorators import permission_required
  6 from django.core.exceptions import ImproperlyConfigured
  7 from django.core.management import call_command
  8 from django.shortcuts import get_object_or_404, redirect
  9 from django.template.response import TemplateResponse
  10 from django.utils.translation import pgettext_lazy
  11 from django_countries.fields import Country
  12 from django_prices_vatlayer.models import VAT
  13 
  14 from ...core import TaxRateType
  15 from ...core.utils import get_paginator_items
  16 from ...core.utils.taxes import get_taxes_for_country
  17 from ...dashboard.taxes.filters import TaxFilter
  18 from ...dashboard.taxes.forms import TaxesConfigurationForm
  19 from ...dashboard.views import staff_member_required
  20 
  21 logger = logging.getLogger(__name__)
  22 
  23 
  24 @staff_member_required
  25 def tax_list(request):
  26     taxes = VAT.objects.order_by('country_code')
  27     tax_filter = TaxFilter(request.GET, queryset=taxes)
  28     taxes = get_paginator_items(
  29         tax_filter.qs, settings.DASHBOARD_PAGINATE_BY, request.GET.get('page'))
  30     ctx = {
  31         'taxes': taxes, 'filter_set': tax_filter,
  32         'is_empty': not tax_filter.queryset.exists()}
  33     return TemplateResponse(request, 'dashboard/taxes/list.html', ctx)
  34 
  35 
  36 @staff_member_required
  37 def tax_details(request, country_code):
  38     tax = get_object_or_404(VAT, country_code=country_code)
  39     tax_rates = get_taxes_for_country(Country(country_code))
  40     translations = dict(TaxRateType.CHOICES)
  41     tax_rates = [
  42         (translations.get(rate_name, rate_name), tax['value'])
  43         for rate_name, tax in tax_rates.items()]
  44     ctx = {'tax': tax, 'tax_rates': sorted(tax_rates)}
  45     return TemplateResponse(request, 'dashboard/taxes/details.html', ctx)
  46 
  47 
  48 @staff_member_required
  49 @permission_required('site.manage_settings')
  50 def configure_taxes(request):
  51     site_settings = request.site.settings
  52     taxes_form = TaxesConfigurationForm(
  53         request.POST or None, instance=site_settings)
  54     if taxes_form.is_valid():
  55         taxes_form.save()
  56         msg = pgettext_lazy('Dashboard message', 'Updated taxes settings')
  57         messages.success(request, msg)
  58         return redirect('dashboard:taxes')
  59     ctx = {'site': site_settings, 'taxes_form': taxes_form}
  60     return TemplateResponse(request, 'dashboard/taxes/form.html', ctx)
  61 
  62 
  63 @staff_member_required
  64 @permission_required('site.manage_settings')
  65 def fetch_tax_rates(request):
  66     try:
  67         call_command('get_vat_rates')
  68         msg = pgettext_lazy(
  69             'Dashboard message', 'Tax rates updated successfully')
  70         messages.success(request, msg)
  71     except ImproperlyConfigured as exc:
  72         logger.exception(exc)
  73         msg = pgettext_lazy(
  74             'Dashboard message',
  75             'Could not fetch tax rates. '
  76             'Make sure you have supplied a valid API Access Key.<br/>'
  77             'Check the server logs for more information about this error.')
  78         messages.warning(request, msg)
  79     return redirect('dashboard:taxes')
  80
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/saleor/dashboard/taxes/views.py b/saleor/dashboard/taxes/views.py
  --- a/saleor/dashboard/taxes/views.py
  +++ b/saleor/dashboard/taxes/views.py
  @@ -8,6 +8,7 @@
   from django.shortcuts import get_object_or_404, redirect
   from django.template.response import TemplateResponse
   from django.utils.translation import pgettext_lazy
  +from django.views.decorators.http import require_POST
   from django_countries.fields import Country
   from django_prices_vatlayer.models import VAT
   
  @@ -61,6 +62,7 @@
   
   
   @staff_member_required
  +@require_POST
   @permission_required('site.manage_settings')
   def fetch_tax_rates(request):
       try:
  
verification_info: {"golden_diff": "diff --git a/saleor/dashboard/taxes/views.py b/saleor/dashboard/taxes/views.py\n--- a/saleor/dashboard/taxes/views.py\n+++ b/saleor/dashboard/taxes/views.py\n@@ -8,6 +8,7 @@\n from django.shortcuts import get_object_or_404, redirect\n from django.template.response import TemplateResponse\n from django.utils.translation import pgettext_lazy\n+from django.views.decorators.http import require_POST\n from django_countries.fields import Country\n from django_prices_vatlayer.models import VAT\n \n@@ -61,6 +62,7 @@\n \n \n @staff_member_required\n+@require_POST\n @permission_required('site.manage_settings')\n def fetch_tax_rates(request):\n     try:\n", "issue": "The fetch vat rates button should not be a GET method\n### What I'm trying to achieve\r\nNot to allow GET methods to fetch vat rates.\r\n\r\n### Steps to reproduce the problem\r\n1. Go to configuration -> Taxes ;\r\n2. The fetch tax rates button, is a GET button.\r\n\r\n### What I expected to happen\r\nGet a POST instead of a GET, which is safer against attacks.\r\n\r\n### Describe a proposed solution\r\nDrop the button link on the dashboard for a submit button or a modal.\r\n\n", "before_files": [{"content": "import logging\n\nfrom django.conf import settings\nfrom django.contrib import messages\nfrom django.contrib.auth.decorators import permission_required\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.core.management import call_command\nfrom django.shortcuts import get_object_or_404, redirect\nfrom django.template.response import TemplateResponse\nfrom django.utils.translation import pgettext_lazy\nfrom django_countries.fields import Country\nfrom django_prices_vatlayer.models import VAT\n\nfrom ...core import TaxRateType\nfrom ...core.utils import get_paginator_items\nfrom ...core.utils.taxes import get_taxes_for_country\nfrom ...dashboard.taxes.filters import TaxFilter\nfrom ...dashboard.taxes.forms import TaxesConfigurationForm\nfrom ...dashboard.views import staff_member_required\n\nlogger = logging.getLogger(__name__)\n\n\n@staff_member_required\ndef tax_list(request):\n    taxes = VAT.objects.order_by('country_code')\n    tax_filter = TaxFilter(request.GET, queryset=taxes)\n    taxes = get_paginator_items(\n        tax_filter.qs, settings.DASHBOARD_PAGINATE_BY, request.GET.get('page'))\n    ctx = {\n        'taxes': taxes, 'filter_set': tax_filter,\n        'is_empty': not tax_filter.queryset.exists()}\n    return TemplateResponse(request, 'dashboard/taxes/list.html', ctx)\n\n\n@staff_member_required\ndef tax_details(request, country_code):\n    tax = get_object_or_404(VAT, country_code=country_code)\n    tax_rates = get_taxes_for_country(Country(country_code))\n    translations = dict(TaxRateType.CHOICES)\n    tax_rates = [\n        (translations.get(rate_name, rate_name), tax['value'])\n        for rate_name, tax in tax_rates.items()]\n    ctx = {'tax': tax, 'tax_rates': sorted(tax_rates)}\n    return TemplateResponse(request, 'dashboard/taxes/details.html', ctx)\n\n\n@staff_member_required\n@permission_required('site.manage_settings')\ndef configure_taxes(request):\n    site_settings = request.site.settings\n    taxes_form = TaxesConfigurationForm(\n        request.POST or None, instance=site_settings)\n    if taxes_form.is_valid():\n        taxes_form.save()\n        msg = pgettext_lazy('Dashboard message', 'Updated taxes settings')\n        messages.success(request, msg)\n        return redirect('dashboard:taxes')\n    ctx = {'site': site_settings, 'taxes_form': taxes_form}\n    return TemplateResponse(request, 'dashboard/taxes/form.html', ctx)\n\n\n@staff_member_required\n@permission_required('site.manage_settings')\ndef fetch_tax_rates(request):\n    try:\n        call_command('get_vat_rates')\n        msg = pgettext_lazy(\n            'Dashboard message', 'Tax rates updated successfully')\n        messages.success(request, msg)\n    except ImproperlyConfigured as exc:\n        logger.exception(exc)\n        msg = pgettext_lazy(\n            'Dashboard message',\n            'Could not fetch tax rates. '\n            'Make sure you have supplied a valid API Access Key.<br/>'\n            'Check the server logs for more information about this error.')\n        messages.warning(request, msg)\n    return redirect('dashboard:taxes')\n", "path": "saleor/dashboard/taxes/views.py"}], "after_files": [{"content": "import logging\n\nfrom django.conf import settings\nfrom django.contrib import messages\nfrom django.contrib.auth.decorators import permission_required\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.core.management import call_command\nfrom django.shortcuts import get_object_or_404, redirect\nfrom django.template.response import TemplateResponse\nfrom django.utils.translation import pgettext_lazy\nfrom django.views.decorators.http import require_POST\nfrom django_countries.fields import Country\nfrom django_prices_vatlayer.models import VAT\n\nfrom ...core import TaxRateType\nfrom ...core.utils import get_paginator_items\nfrom ...core.utils.taxes import get_taxes_for_country\nfrom ...dashboard.taxes.filters import TaxFilter\nfrom ...dashboard.taxes.forms import TaxesConfigurationForm\nfrom ...dashboard.views import staff_member_required\n\nlogger = logging.getLogger(__name__)\n\n\n@staff_member_required\ndef tax_list(request):\n    taxes = VAT.objects.order_by('country_code')\n    tax_filter = TaxFilter(request.GET, queryset=taxes)\n    taxes = get_paginator_items(\n        tax_filter.qs, settings.DASHBOARD_PAGINATE_BY, request.GET.get('page'))\n    ctx = {\n        'taxes': taxes, 'filter_set': tax_filter,\n        'is_empty': not tax_filter.queryset.exists()}\n    return TemplateResponse(request, 'dashboard/taxes/list.html', ctx)\n\n\n@staff_member_required\ndef tax_details(request, country_code):\n    tax = get_object_or_404(VAT, country_code=country_code)\n    tax_rates = get_taxes_for_country(Country(country_code))\n    translations = dict(TaxRateType.CHOICES)\n    tax_rates = [\n        (translations.get(rate_name, rate_name), tax['value'])\n        for rate_name, tax in tax_rates.items()]\n    ctx = {'tax': tax, 'tax_rates': sorted(tax_rates)}\n    return TemplateResponse(request, 'dashboard/taxes/details.html', ctx)\n\n\n@staff_member_required\n@permission_required('site.manage_settings')\ndef configure_taxes(request):\n    site_settings = request.site.settings\n    taxes_form = TaxesConfigurationForm(\n        request.POST or None, instance=site_settings)\n    if taxes_form.is_valid():\n        taxes_form.save()\n        msg = pgettext_lazy('Dashboard message', 'Updated taxes settings')\n        messages.success(request, msg)\n        return redirect('dashboard:taxes')\n    ctx = {'site': site_settings, 'taxes_form': taxes_form}\n    return TemplateResponse(request, 'dashboard/taxes/form.html', ctx)\n\n\n@staff_member_required\n@require_POST\n@permission_required('site.manage_settings')\ndef fetch_tax_rates(request):\n    try:\n        call_command('get_vat_rates')\n        msg = pgettext_lazy(\n            'Dashboard message', 'Tax rates updated successfully')\n        messages.success(request, msg)\n    except ImproperlyConfigured as exc:\n        logger.exception(exc)\n        msg = pgettext_lazy(\n            'Dashboard message',\n            'Could not fetch tax rates. '\n            'Make sure you have supplied a valid API Access Key.<br/>'\n            'Check the server logs for more information about this error.')\n        messages.warning(request, msg)\n    return redirect('dashboard:taxes')\n", "path": "saleor/dashboard/taxes/views.py"}]}