Skip to content
Snippets Groups Projects
Commit 9ca6ef80 authored by sandeepsajan0's avatar sandeepsajan0 Committed by Fredrik Jonsson
Browse files

Add File_Allowed_Extensions validation in ExtendedFormBuilder

parent 0bb380a1
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ from django.conf import settings
from django.core.files.storage import get_storage_class
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.forms import FileField
from django.forms import FileField, FileInput
from django.utils.decorators import method_decorator
from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import never_cache
......@@ -42,7 +42,7 @@ class FormField(AbstractFormField):
class ExtendedFormBuilder(FormBuilder):
def create_document_field(self, field, options):
return FileField(**options)
return FileField(widget=FileInput(attrs={'accept': settings.FILE_ALLOWED_EXTENSIONS}), **options)
@method_decorator(never_cache, name='serve')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment