FileView.get() missing 1 required positional argument: 'request'

S o i want to called func to html. but when i click the button, it have error message. what i want is, i can save bytes to string and save it to file text. f contains with b’5&\xd7\x8c’ (it’s bytes) , it’s the result from encryption

FileView.get() missing 1 required positional argument: ‘request’

i don’t know what’s wrong, can someone check it please?

def create_file(f):
    with open("file.txt", 'w') as file:
        return file.write(str(f))

class FileView(View):

    def get(f, self, request, *args, **kwargs):
        return HttpResponse(f, content_type='text/plain', headers={'Content-Disposition': 'attachment; filename=file.txt'})

def homepage(request):
    form = AudioForm()
    if request.method == "POST":
        form = AudioForm(request.POST, request.FILES)
        if form.is_valid():
            form.save()
            last_audio = Audio_store.objects.all().last()
            plaintext = Audio_store.objects.all().values_list('password').last()
            key = Audio_store.objects.all().values_list('key').last()
            pt = plaintext[0]
            ky = key[0]
            print(pt)
            print(ky)
            context={'form':form, 'last_audio':last_audio}
            enc = encrypt(ky, pt)
            print(enc)
            download = create_file(enc)
            print(download)
            return render(request, "homepage.html", context)

    context={'form':form}
    return render(request, "homepage.html", context=context)

in urls:

path("", views.homepage, name="homepage"), # to call homepage
path("", views.encrypt, name="homepage"),
path("create_file", views.FileView.as_view(), name="create_file"),

in html to called:

<a href="{% url 'create_file' %}">
                                            Download
                                        </a>

In FileView.get(), there’s a parameter called fthat is at the front of the parameter list. Django calls the get() method with self, request, *args, **kwargs. Since there are no positional arguments in *args, get() raises an exception about a parameter that isn’t there. I would try to either remove that f parameter or move it past the self and request arguments.