Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed deprecated mimetype argument from HttpResponse #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.pyc
/build
/dist
10 changes: 10 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -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
55 changes: 22 additions & 33 deletions database_files/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -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()),
],
),
]
2 changes: 1 addition & 1 deletion database_files/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

setup(
name='django-database-files',
version='0.1',
version='0.1.2',
description='A storage system for Django that stores uploaded files in the database.',
author='Ben Firshman',
author_email='[email protected]',
url='http://github.com/bfirsh/django-database-files/',
packages=[
'database_files',
'database_files/migrations',
],
classifiers=['Development Status :: 4 - Beta',
'Framework :: Django',
Expand Down