From 179dfc3563e42eb34199985f8b48851ab07a8a55 Mon Sep 17 00:00:00 2001 From: Jill Vogel Date: Wed, 10 Dec 2014 15:52:46 +1030 Subject: [PATCH 1/3] Changed HttpResponse mimetype parameter to content_type, as mimetype is deprecated. --- database_files/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database_files/views.py b/database_files/views.py index 2f08960..abf7db0 100644 --- a/database_files/views.py +++ b/database_files/views.py @@ -15,6 +15,6 @@ def serve(request, name): raise Http404('Filename is not an integer') f = get_object_or_404(File, pk=pk) mimetype = mimetypes.guess_type(name)[0] or 'application/octet-stream' - response = HttpResponse(base64.b64decode(f.content), mimetype=mimetype) + response = HttpResponse(base64.b64decode(f.content), content_type=mimetype) response['Content-Length'] = f.size return response From 5b0a96345fac75998e4cbe2165f799a0821ba6f0 Mon Sep 17 00:00:00 2001 From: Jill Vogel Date: Mon, 3 Aug 2015 14:04:31 +0930 Subject: [PATCH 2/3] Bumped version number to avoid conflict with pypi version of this library. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 52eda75..b40bb26 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='django-database-files', - version='0.1', + version='0.1.1', description='A storage system for Django that stores uploaded files in the database.', author='Ben Firshman', author_email='ben@firshman.co.uk', From f70a2a30c5917e747f56f81346baae3926e98e0d Mon Sep 17 00:00:00 2001 From: Jill Vogel Date: Mon, 18 Jan 2016 12:07:50 +1030 Subject: [PATCH 3/3] Updated migrations to use django.db.migrations instead of south. Also updated the setup and MANIFEST to ensure the migrations are distributed. --- .gitignore | 1 + MANIFEST | 10 +++++ database_files/migrations/0001_initial.py | 55 +++++++++-------------- setup.py | 3 +- 4 files changed, 35 insertions(+), 34 deletions(-) create mode 100644 MANIFEST diff --git a/.gitignore b/.gitignore index 57e683c..cab6402 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc /build +/dist diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..bc60f04 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,10 @@ +# file GENERATED by distutils, do NOT edit +setup.py +database_files/__init__.py +database_files/manager.py +database_files/models.py +database_files/storage.py +database_files/urls.py +database_files/views.py +database_files/migrations/0001_initial.py +database_files/migrations/__init__.py diff --git a/database_files/migrations/0001_initial.py b/database_files/migrations/0001_initial.py index 7d0ebfc..49a3d42 100644 --- a/database_files/migrations/0001_initial.py +++ b/database_files/migrations/0001_initial.py @@ -1,35 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.1 on 2016-01-18 01:34 +from __future__ import unicode_literals -from south.db import db -from django.db import models -from database_files.models import * +from django.db import migrations, models -class Migration: - - def forwards(self, orm): - - # Adding model 'File' - db.create_table('database_files_file', ( - ('id', orm['database_files.File:id']), - ('content', orm['database_files.File:content']), - ('size', orm['database_files.File:size']), - )) - db.send_create_signal('database_files', ['File']) - - - - def backwards(self, orm): - - # Deleting model 'File' - db.delete_table('database_files_file') - - - - models = { - 'database_files.file': { - 'content': ('django.db.models.fields.TextField', [], {}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'size': ('django.db.models.fields.IntegerField', [], {}) - } - } - - complete_apps = ['database_files'] + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='File', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('content', models.TextField()), + ('size', models.IntegerField()), + ], + ), + ] diff --git a/setup.py b/setup.py index b40bb26..61edece 100644 --- a/setup.py +++ b/setup.py @@ -4,13 +4,14 @@ setup( name='django-database-files', - version='0.1.1', + version='0.1.2', description='A storage system for Django that stores uploaded files in the database.', author='Ben Firshman', author_email='ben@firshman.co.uk', url='http://github.com/bfirsh/django-database-files/', packages=[ 'database_files', + 'database_files/migrations', ], classifiers=['Development Status :: 4 - Beta', 'Framework :: Django',