![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
django-file-validator
Advanced tools
Simple project to validate FileFields/ImageFields, like max size of uploaded files.
.. image:: https://travis-ci.org/adrianoveiga/django-file-validator.svg?branch=master :target: https://travis-ci.org/adrianoveiga/django-file-validator
.. image:: https://badge.fury.io/py/django-file-validator.svg :target: https://badge.fury.io/py/django-file-validator
Simple project to validate FileFields/ImageFields, like max size of uploaded file.
Until now, there is only one validator: MaxSizeValidator.
NOT WORKING WITH NEW DJANGO 1.10.
.. code-block:: python
pip install django-file-validator
In your models, import and use MaxSizeValidator:
.. code-block:: python
from django_file_validator.validators import MaxSizeValidator
class YourModel(models.Model):
. . .
image = models.ImageField( null=True, blank=True, upload_to='uploads/yourmodel/img/', validators=[MaxSizeValidator()])
. . .
You can change the max size value passing a parameter on each attibute:
.. code-block:: python
from django_file_validator.validators import MaxSizeValidator
class YourModel(models.Model):
. . .
default_image = models.ImageField( null=True, blank=True, upload_to='uploads/yourmodel/img/', validators=[MaxSizeValidator()])
big_image = models.ImageField( null=True, blank=True, upload_to='uploads/yourmodel/img/', validators=[MaxSizeValidator(2048)])
small_image = models.ImageField( null=True, blank=True, upload_to='uploads/yourmodel/img/', validators=[MaxSizeValidator(256)])
. . .
FILE_SIZE_LIMIT_IN_KILOBYTES You can change the default max size limit of uploaded files, just putting this variable on settings.py. Default value is 512 kB.
.. code-block:: python
FILE_SIZE_LIMIT_IN_KILOBYTES=512
FAQs
Simple project to validate FileFields/ImageFields, like max size of uploaded files.
We found that django-file-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.