Skip to main content
https://drone.io/bitbucket.org/slafs/django-binaryfield/status.png

A generic app to provide a way to handle database binary data in django.

Introduction

This is a total rip-off of BinaryField class from Django 1.6+ sourcecode with some tweaks to make it work under Django 1.4+.

Installation

pip install django-binaryfield

Usage

Use BinaryField to bind your binary database columns on a django model. Like so:

from binaryfield import BinaryField

class ExampleModel(models.Model):

    short_data = BinaryField(max_length=10, default=b'\x08')
    data = BinaryField()

Configuration

syncdb

Django-binaryfield works out-of-the-box with existing binary database columns that are correctly mapped in your models. If you want BinaryField to work with syncdb management command there’s one setting called BINARYFIELD_HACK_ENGINES that can be used to hack Django database backend. Use it like this:

BINARYFIELD_HACK_ENGINES = (
    'django.db.backends.sqlite3',
)

It’s a list of django backends (as an “importable” strings) to mangle in order to syncdb could work properly. Did I mention that it is a hack?

Oracle issues

There are some issues with Oracle when handling parameteres in a query in Django < 1.6. You can see this link (https://github.com/django/django/commit/8aefd30379eba9aa7e5afcc69cc352adf0d23489) to see what changed in django.db.backends.oracle.base.OracleParam class regarding this feature.

There are two settings to control a fix to this issue:

  • BINARYFIELD_HACK_ORACLE_PARAM - determines whether or not apply the fix - Default: False

  • BINARYFIELD_HACK_ORACLE_PARAM_BACKENDS - an iterable of backend engines as an “importable” strings to apply the fix. - Default: [ settings.DATABASES['default']['ENGINE'] ]

TODO

  • Some more tests maybe?

  • An example view to show how to serve a file from database

Metadata

Release files for django-binaryfield 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-binaryfield 0.4.0
File Size Uploaded Provenance
django-binaryfield-0.4.0.tar.gz 5.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-binaryfield 0.4.0
File Interpreter ABI Platform
django_binaryfield-0.4.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.1 kB

Release files / django-binaryfield-0.4.0.tar.gz

Download URL django-binaryfield-0.4.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
43b77383f1e993e6120a9d532e957b5834970cfb04a5844e486b6c7caaba0de9
BLAKE2b-256 checksum
How to use checksums
e10631cff6d31b7450dd58992866970db3daeabd5e815c3dc8dfa9a2d28797e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_binaryfield-0.4.0-py2.py3-none-any.whl

Download URL django_binaryfield-0.4.0-py2.py3-none-any.whl
Size 7.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d8afadc0a7e9d6c71bf0b23c3b587023d6cae7ae8d220c664d5ee2d27b73563a
BLAKE2b-256 checksum
How to use checksums
aa00963f75505576c201bcbce0499206ffc1395865bf44d95e08b3096386eff8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-binaryfield 0.4.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page