old_contents: from pathlib import PurePath
  from tempfile import mkdtemp
  from django.contrib.auth.mixins import LoginRequiredMixin
  from django.http import HttpResponse
  from django.views.generic import TemplateView, View
  
  from .io.xlsx import generate_template
  
  
  class DownloadXLSXTemplateView(LoginRequiredMixin, TemplateView):
  
      template_name = 'submission/download_xlsx_template.html'
  
      def get_context_data(self, **kwargs):
          ctx = super().get_context_data(**kwargs)
          ctx.update({
              'step': 'download',
          })
          return ctx
  
  
  class GenerateXLSXTemplateView(LoginRequiredMixin, View):
  
      def post(self, request, *args, **kwargs):
  
          template_file_name = 'pixel_template.xlsx'
          template_path = PurePath(mkdtemp(), template_file_name)
          generate_template(template_path)
  
          response = HttpResponse(
              content_type=(
                  'application/vnd'
                  '.openxmlformats-officedocument'
                  '.spreadsheetml'
                  '.sheet'
              )
          )
          content_disposition = 'attachment; filename="{}"'.format(
              template_file_name
          )
          response['Content-Disposition'] = content_disposition
  
          with open(template_path, 'rb') as template:
              response.write(template.read())
  
          return response
  
new_contents: from pathlib import PurePath
  from tempfile import mkdtemp
  from django.contrib.auth.mixins import LoginRequiredMixin
  from django.http import HttpResponse
  from django.views.generic import TemplateView, View
  
  from .io.xlsx import generate_template
  
  
  class DownloadXLSXTemplateView(LoginRequiredMixin, TemplateView):
  
      template_name = 'submission/download_xlsx_template.html'
  
      def get_context_data(self, **kwargs):
          ctx = super().get_context_data(**kwargs)
          ctx.update({
              'step': 'download',
          })
          return ctx
  
  
  class GenerateXLSXTemplateView(LoginRequiredMixin, View):
  
      def post(self, request, *args, **kwargs):
  
          template_file_name = 'meta.xlsx'
          template_path = PurePath(mkdtemp(), template_file_name)
          generate_template(template_path)
  
          response = HttpResponse(
              content_type=(
                  'application/vnd'
                  '.openxmlformats-officedocument'
                  '.spreadsheetml'
                  '.sheet'
              )
          )
          content_disposition = 'attachment; filename="{}"'.format(
              template_file_name
          )
          response['Content-Disposition'] = content_disposition
  
          with open(template_path, 'rb') as template:
              response.write(template.read())
  
          return response
  
subject: Update pixel's template file name to meta.xlsx