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
File details
Details for the file django-content-safe-uploader-0.1.0.tar.gz
.
File metadata
- Download URL: django-content-safe-uploader-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c323d705deb8ca83d553ab61a023618e6b816416c44ef657e14b4ad882a7e18 |
|
MD5 | ba2a014cdea20d15a000e2504a4bc889 |
|
BLAKE2b-256 | bd3e59b28487cd34719ea026c0cce2a697e3b01e814cdfee5ebfbaf2df192513 |
File details
Details for the file django_content_safe_uploader-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: django_content_safe_uploader-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c01114d7219f2295bc815d4e6eb966661a41eddb30ff48ff1d2bd151dedb515 |
|
MD5 | 9a8d1311f1b8053ae352b68eb4952e3e |
|
BLAKE2b-256 | bff3a90ecfd912e821883b99c2eae1431565ebf0491213888bb4c66d3678b343 |