skip to navigation
skip to content

django-binaryfield 0.3.1

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

Latest Version: 0.4.0

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


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+.


pip install django-binaryfield


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()



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:


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 ( to see what changed in 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'] ]


  • Some more tests maybe?
  • An example view to show how to serve a file from database
  • try to setup travis-ci testing
File Type Py Version Uploaded on Size
django-binaryfield-0.3.1.tar.gz (md5) Source 2014-01-28 5KB
django_binaryfield-0.3.1-py2.py3-none-any.whl (md5) Python Wheel 2.7 2014-01-28 6KB