diff --git a/.gitignore b/.gitignore index b0d4e48..55e6249 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,9 @@ db /share /env /venv -/django-jquery-file-upload + *.log *.pot *.pyc local_settings.py +.idea \ No newline at end of file diff --git a/__init__.py b/django-jquery-file-upload/__init__.py similarity index 100% rename from __init__.py rename to django-jquery-file-upload/__init__.py diff --git a/settings.py b/django-jquery-file-upload/settings.py similarity index 98% rename from settings.py rename to django-jquery-file-upload/settings.py index 68744b1..d7e49bd 100644 --- a/settings.py +++ b/django-jquery-file-upload/settings.py @@ -100,6 +100,7 @@ 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', ) ROOT_URLCONF = 'django-jquery-file-upload.urls' diff --git a/urls.py b/django-jquery-file-upload/urls.py similarity index 88% rename from urls.py rename to django-jquery-file-upload/urls.py index 00270ad..0c3e2d4 100644 --- a/urls.py +++ b/django-jquery-file-upload/urls.py @@ -19,7 +19,7 @@ url(r'^admin/', include(admin.site.urls)), ) -import os +from os.path import join, abspath, dirname urlpatterns += patterns('', - (r'^media/(.*)$', 'django.views.static.serve', {'document_root': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media')}), + (r'^media/(.*)$', 'django.views.static.serve', {'document_root': join(abspath(dirname(dirname(__file__))), 'media')}), ) 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/fileupload/views.py b/fileupload/views.py index 98b339c..e9f6b01 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() diff --git a/manage.py b/manage.py index 3e4eedc..92a4d6e 100755 --- a/manage.py +++ b/manage.py @@ -1,14 +1,24 @@ #!/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) +# 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 +# +# if __name__ == "__main__": +# execute_manager(settings) -import settings +#!/usr/bin/env python +import os, sys if __name__ == "__main__": - execute_manager(settings) + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django-jquery-file-upload.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..67a04d6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -django<1.6 +django pillow