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.
Release files for django-content-safe-uploader 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-content-safe-uploader-0.1.0.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_content_safe_uploader-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.7 kB
Release files / django-content-safe-uploader-0.1.0.tar.gz
| Download URL | django-content-safe-uploader-0.1.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c323d705deb8ca83d553ab61a023618e6b816416c44ef657e14b4ad882a7e18
|
|
BLAKE2b-256 checksum How to use checksums |
bd3e59b28487cd34719ea026c0cce2a697e3b01e814cdfee5ebfbaf2df192513
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / django_content_safe_uploader-0.1.0-py3-none-any.whl
| Download URL | django_content_safe_uploader-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c01114d7219f2295bc815d4e6eb966661a41eddb30ff48ff1d2bd151dedb515
|
|
BLAKE2b-256 checksum How to use checksums |
bff3a90ecfd912e821883b99c2eae1431565ebf0491213888bb4c66d3678b343
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|