From 302e2f102b4fc003b4e278faa4f10393ca2aa7d1 Mon Sep 17 00:00:00 2001 From: Neil Newman Date: Thu, 15 Jan 2015 20:57:09 -0500 Subject: [PATCH 1/2] Updated to support Django 1.7 --- .gitignore | 1 + fileupload/response.py | 4 ++-- manage.py | 18 +++++++----------- requirements.txt | 2 +- settings.py | 2 +- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index b0d4e48..fbd88dc 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ db /env /venv /django-jquery-file-upload +/static *.log *.pot *.pyc diff --git a/fileupload/response.py b/fileupload/response.py index 829685a..334eb29 100644 --- a/fileupload/response.py +++ b/fileupload/response.py @@ -1,6 +1,6 @@ # encoding: utf-8 from django.http import HttpResponse -from django.utils import simplejson +import json MIMEANY = '*/*' MIMEJSON = 'application/json' @@ -34,5 +34,5 @@ def a_iew(request): """ def __init__(self, obj='', json_opts=None, mimetype=MIMEJSON, *args, **kwargs): json_opts = json_opts if isinstance(json_opts, dict) else {} - content = simplejson.dumps(obj, **json_opts) + content = json.dumps(obj, **json_opts) super(JSONResponse, self).__init__(content, mimetype, *args, **kwargs) diff --git a/manage.py b/manage.py index 3e4eedc..f9726f9 100755 --- a/manage.py +++ b/manage.py @@ -1,14 +1,10 @@ #!/usr/bin/env python -from django.core.management import execute_manager -import imp -try: - imp.find_module('settings') # Assumed to be in the same directory. -except ImportError: - import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__) - sys.exit(1) - -import settings +import os +import sys if __name__ == "__main__": - execute_manager(settings) + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/requirements.txt b/requirements.txt index 23cb63a..8355df6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -django<1.6 +django<1.8 pillow diff --git a/settings.py b/settings.py index 68744b1..32d77c1 100644 --- a/settings.py +++ b/settings.py @@ -102,7 +102,7 @@ 'django.contrib.messages.middleware.MessageMiddleware', ) -ROOT_URLCONF = 'django-jquery-file-upload.urls' +ROOT_URLCONF = 'urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". From 96b99b5bb6b2d6ee89992d2b3d59d3ad1386ef98 Mon Sep 17 00:00:00 2001 From: xfuren Date: Thu, 30 Apr 2015 08:17:13 +0800 Subject: [PATCH 2/2] Updated to support Django 1.8 --- fileupload/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fileupload/views.py b/fileupload/views.py index 98b339c..44d1d2d 100644 --- a/fileupload/views.py +++ b/fileupload/views.py @@ -10,6 +10,7 @@ class PictureCreateView(CreateView): model = Picture + fields = '__all__' def form_valid(self, form): self.object = form.save()