From c9c7d077415c805e9962d62a5eb294d1faef446f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADn?= Date: Mon, 13 Oct 2014 14:52:13 +0200 Subject: [PATCH] Now django.multiselectfield support Django 1.7 --- README.rst | 1 + .../fixtures/{initial_data.json => data.json} | 0 example/example/app/tests.py | 2 ++ example/example/settings.py | 6 ++--- example/run_tests.py | 6 ++++- tox.ini | 27 ++++++++++++++++++- 6 files changed, 37 insertions(+), 5 deletions(-) rename example/example/app/fixtures/{initial_data.json => data.json} (100%) diff --git a/README.rst b/README.rst index 65a7da1..da75c5a 100644 --- a/README.rst +++ b/README.rst @@ -90,4 +90,5 @@ a readily setup project that uses django-multiselectfield. You can run it as usu :: python manage.py syncdb --noinput + python manage.py loaddata data python manage.py runserver diff --git a/example/example/app/fixtures/initial_data.json b/example/example/app/fixtures/data.json similarity index 100% rename from example/example/app/fixtures/initial_data.json rename to example/example/app/fixtures/data.json diff --git a/example/example/app/tests.py b/example/example/app/tests.py index 962402e..68530e2 100644 --- a/example/example/app/tests.py +++ b/example/example/app/tests.py @@ -23,6 +23,8 @@ from example.app.models import Book class MultiSelectTestCase(TestCase): + fixtures = ['data.json'] + def test_filter(self): self.assertEqual(Book.objects.filter(tags__contains='sex').count(), 1) self.assertEqual(Book.objects.filter(tags__contains='boring').count(), 0) diff --git a/example/example/settings.py b/example/example/settings.py index 512792a..ba6dd66 100644 --- a/example/example/settings.py +++ b/example/example/settings.py @@ -21,7 +21,7 @@ from os import path DEBUG = True TEMPLATE_DEBUG = DEBUG -BASEDIR = path.dirname(path.abspath(__file__)) +BASE_DIR = path.dirname(path.abspath(__file__)) ADMINS = ( # ('Your Name', 'your_email@example.com'), @@ -70,7 +70,7 @@ USE_TZ = True # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/var/www/example.com/media/" -MEDIA_ROOT = path.join(BASEDIR, 'media') +MEDIA_ROOT = path.join(BASE_DIR, 'media') # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. @@ -81,7 +81,7 @@ MEDIA_URL = '/media/' # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/var/www/example.com/static/" -STATIC_ROOT = path.join(BASEDIR, 'static') +STATIC_ROOT = path.join(BASE_DIR, 'static') # URL prefix for static files. # Example: "http://example.com/static/", "http://static.example.com/" diff --git a/example/run_tests.py b/example/run_tests.py index 00c10f8..ba31e54 100644 --- a/example/run_tests.py +++ b/example/run_tests.py @@ -30,7 +30,11 @@ if len(sys.argv) == 1: else: os.environ[ENVIRONMENT_VARIABLE] = sys.argv[1] -if django.VERSION[0] == 1 and django.VERSION[1] <= 5: +if django.VERSION[0] >= 1 and django.VERSION[1] >= 7: + from django.core.wsgi import get_wsgi_application + application = get_wsgi_application() + +if django.VERSION[0] >= 1 and django.VERSION[1] <= 5: management.call_command('test', 'app') else: management.call_command('test', 'example.app') diff --git a/tox.ini b/tox.ini index f275791..2bfae2f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27-dj16,py27-dj15,py27-dj14,py33-dj16,py33-dj15,py26-dj16,py26-dj15,py26-dj14 +envlist = py27-dj17,py27-dj16,py27-dj15,py27-dj14,py34-dj17,py33-dj17,py33-dj16,py33-dj15,py26-dj16,py26-dj15,py26-dj14 [testenv] usedevelop = True @@ -33,6 +33,14 @@ deps = PyYAML==3.10 coveralls==0.3 +[testenv:py27-dj17] +basepython = python2.7 +deps = + django==1.7 + pillow==1.7.8 + PyYAML==3.10 + coveralls==0.3 + [testenv:py27-dj16] basepython = python2.7 deps = @@ -58,6 +66,23 @@ deps = PyYAML==3.10 coveralls==0.3 +[testenv:py34-dj17] +basepython = python3.4 +deps = + django==1.7 + pillow==2.1.0 + PyYAML==3.10 + coveralls==0.3 + +[testenv:py33-dj17] +basepython = python3.3 +deps = + django==1.7 + pillow==2.1.0 + PyYAML==3.10 + coveralls==0.3 + + [testenv:py33-dj16] basepython = python3.3 deps =