Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

This field is required error #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
isik-kaplan opened this issue Apr 17, 2022 · 0 comments
Closed

This field is required error #213

isik-kaplan opened this issue Apr 17, 2022 · 0 comments

Comments

@isik-kaplan
Copy link

With this simple setup:

direct_s3_storage = S3OptimizedUploadStorage()

class FileUpload(models.Model):
    file = models.FileField(storage=direct_s3_storage)
    
class CsvUploadForm(ModelForm):
    class Meta:
        model = FileUpload
        fields = ["file"]

class FileUploadView(FormView):
    form_class = FileUploadForm
    template_name = "upload.html"
<form method="post" enctype="multipart/form-data">    
    {% csrf_token %}
    {{ form }}
</form>
{{ form.media.js }}

I keep getting File: This field is required.

When I add {{ form.media.js }} request.FILES is empty, and "file" in request.POST, when I remove the {{ form.media.js }} request.FILES has "file" and "file" not in request.POST

I have the app and the middleware.

I've tried to figure it out myself but couldn't. I feel like I'm missing something, but I'm not entire sure what. Should I initiate my form differently?

Repository owner locked and limited conversation to collaborators Apr 20, 2022
@codingjoe codingjoe converted this issue into discussion #214 Apr 20, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant