Hey Django developers,
I am a Django developer with about 2.5 years of experience. I just decided
to contribute to the Django framework. I am interested in adding a new
decorator in Django. This decorator will be used for file validation
purposes.
This decorator checks the file extensions and size. If the file extensions
and size provided by the developer are not in the request.FILES then it
will raise errors. In this way, developers don't need to modify their
functions to check the file validations.
For example,
*@require_files(["pdf", "txt", 20])*
def file_upload_view(request):
return HttpResposne("Successful")
Here this decorator will check if the file types are (*pdf* or *txt*) else
will raise *TypeError. *Also, check if each file size is less than *20 MB.
*If not, will raise *IOError.*
I had already started working on this decorator and had written multiple
tests. So the functionality is almost implemented. However, I wanted to
discuss this idea with the Django community to make sure that it follows
Django design principles and that there is no functionality already
implemented.
Could someone provide the best guidance? Shall I proceed further and make a
pull request? or Make a separate Django package?
Thank you for your time.
Best Regards,
Raza Ul Mustafa
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/40a6262d-dca1-4d47-9303-1edf5b7bb888n%40googlegroups.com.