FileField security validators: FileExtensionValidator, FileContentMatchesWithFileExtensionValidator.
Project description
django-content-safe-uploader
FileField security validators: FileExtensionValidator, FileContentMatchesWithFileExtensionValidator.
Install
pip install django-content-safe-uploader
Usage
pro/settings.py
INSTALLED_APPS = [
...
"django_content_safe_uploader",
...
]
app/models.py
from django.db import models
from django_content_safe_uploader.validators import FileExtensionValidator
from django_content_safe_uploader.validators import FileContentMatchesWithFileExtensionValidator
from django_content_safe_uploader.validators import IMAGE_EXTENSIONS
class Book(models.Model):
title = models.CharField(max_length=128)
preview = models.FileField(
upload_to="book_previews",
validators=[
FileExtensionValidator(*IMAGE_EXTENSIONS),
FileContentMatchesWithFileExtensionValidator(lax_extensions=[IMAGE_EXTENSIONS]),
])
Release
v0.1.0
- First release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-content-safe-uploader-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c323d705deb8ca83d553ab61a023618e6b816416c44ef657e14b4ad882a7e18 |
|
MD5 | ba2a014cdea20d15a000e2504a4bc889 |
|
BLAKE2b-256 | bd3e59b28487cd34719ea026c0cce2a697e3b01e814cdfee5ebfbaf2df192513 |
Close
Hashes for django_content_safe_uploader-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c01114d7219f2295bc815d4e6eb966661a41eddb30ff48ff1d2bd151dedb515 |
|
MD5 | 9a8d1311f1b8053ae352b68eb4952e3e |
|
BLAKE2b-256 | bff3a90ecfd912e821883b99c2eae1431565ebf0491213888bb4c66d3678b343 |