drf-base64-filename
drf-base64-filename provides Serializer fields for using base64-encoded files with file names.
Setup
Install drf-base64-filename to your Python environment
pip install drf-base64-filename
Usage
Sample Model
class SampleBase64ImageModel(models.Model):
parent = models.ForeignKey(
SampleParentModel, on_delete=models.CASCADE,
related_name='image_set', blank=True, null=True)
image = models.ImageField(blank=True)
class SampleBase64FileModel(models.Model):
parent = models.ForeignKey(
SampleParentModel, on_delete=models.CASCADE,
related_name='file_set', blank=True, null=True)
file = models.FileField(blank=True)
Serializer Field
class SampleNamedBase64ImageSerializer(serializers.ModelSerializer):
image = NamedBase64ImageField(required=False, allow_null=True)
class Meta:
model = SampleBase64ImageModel
fields = (
'id',
'image',
)
class SampleNamedBase64FileSerializer(serializers.ModelSerializer):
file = NamedBase64FileField(required=False, allow_null=True)
class Meta:
model = SampleBase64FileModel
fields = (
'id',
'file',
)
Sample request data
{
"image": {
"file_name": "pby.jpg",
"encoded_str": "aHR0cHM6Ly9naXRodWIuY29tL2xlZWhhbnllb25n"
}
}
Sample response data
{
"image": "http://test/media/pby.jpg"
}
Contributing
As an open source project, we welcome contributions. The code lives on GitHub
Metadata
Release files for drf-base64-filename 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| drf-base64-filename-1.0.1.tar.gz | 4.9 kB | Without provenance | Details for drf-base64-filename-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| drf_base64_filename-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for drf_base64_filename-1.0.1-py3-none-any.whl |
Total release size: 10.3 kB
Release files / drf-base64-filename-1.0.1.tar.gz
| Download URL | drf-base64-filename-1.0.1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8b7f68df8af65872c896050fae4e57d362d59ff0cf0d2eedd8739f0005177d4
|
|
BLAKE2b-256 checksum How to use checksums |
b5cde56b928c9f4fd223506711f04bc93845bb1436c28e5bbed0fb56b47b0457
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / drf_base64_filename-1.0.1-py3-none-any.whl
| Download URL | drf_base64_filename-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
427f17f9781e2536f222986cb34360faead13ff76f9f3325903f8f11de00e19b
|
|
BLAKE2b-256 checksum How to use checksums |
9d2143852b1f015de1655583cf0912af634b181809ceec5390189312185c3128
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Security for drf-base64-filename 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.