Go to file
2016-12-08 15:45:35 -05:00
dbfilestorage Rename Storage Class (#10) 2016-12-08 15:43:34 -05:00
docs Rename Storage Class (#10) 2016-12-08 15:43:34 -05:00
tests Rename Storage Class (#10) 2016-12-08 15:43:34 -05:00
.coveragerc Setup for Coverage and Codcov.io (#6) 2016-12-08 14:54:53 -05:00
.gitignore Initial commit after moving from Gitlab 2016-12-07 22:50:48 -05:00
.gitlab-ci.yml Initial commit after moving from Gitlab 2016-12-07 22:50:48 -05:00
circle.yml fix circle? 2016-12-08 14:25:17 -05:00
LICENSE.txt Initial commit after moving from Gitlab 2016-12-07 22:50:48 -05:00
manage.py Initial commit after moving from Gitlab 2016-12-07 22:50:48 -05:00
README.md Update Version number 2016-12-08 15:31:46 -05:00
requirements.txt Setup for Coverage and Codcov.io (#6) 2016-12-08 14:54:53 -05:00
setup.cfg More tests (#9) 2016-12-08 15:30:39 -05:00
setup.py Rename Storage Class (#10) 2016-12-08 15:43:34 -05:00

Django-dbfilestorage

CircleCI codecov

Custom file storage for Django that stores file data and content type in the database. Easy to use for testing when you don't care about a filename, and just want to test file data.

Intended to be used in tests, never in production.

INSTALLATION

pip install django-dbfilestorage

Then in your project's settings.py file, add 'dbfilestorage' to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'dbfilestorage'
)

Next, if you want to set this globally, set the setting:

DEFAULT_FILE_STORAGE='dbfilestorage.storage.DBFileStorage'

Or you can set it individually on a field: Django Docs

from dbfilestorage.storage import DBFileStorage

class SomeClass(models.Model):
    file = models.FileField(upload_to=u'anywhere',
        storage=DBFileStorage())

TODO

  • More Tests
  • Test that this works on a fake model, not just the storage file.
  • Different django and different python versions.
  • Store original filename in a field, maybe?
  • Use original filename instead, so it honors the "upload_to" parameter.

CHANGELOG

  • 2016-12-08 [Tyrel Souza] Add more documentation.
  • 2016-12-07 [Tyrel Souza] Update Readme, move to github, gitlab wasn't functioning properly.
  • 2016-12-07 [Tyrel Souza] Initial commits and basic project setup