diff --git a/.travis.yml b/.travis.yml index 3540c2b..c8304ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,11 @@ cache: - "~/.cache/pip" python: - '2.7' -- '3.4' +- '3.6' - '3.5' env: - DJANGO=2.0 -- DJANGO=1.10 +- DJANGO=2.1 - DJANGO=1.11 - DJANGO=master matrix: @@ -18,10 +18,14 @@ matrix: env: DJANGO=master - python: '2.7' env: DJANGO=2.0 + - python: '2.7' + env: DJANGO=2.1 + - python: '3.6' + env: DJANGO=1.11 allow_failures: - python: '3.5' env: DJANGO=master - - python: '3.4' + - python: '3.6' env: DJANGO=master install: diff --git a/AUTHORS.rst b/AUTHORS.rst index afc7c06..03dfd66 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -4,6 +4,7 @@ CONTRIBUTORS Project Lead ------------ +* Asif Saif Uddin (@auvipy) * Daniel Greenfeld (@pydanny / ) Translation Managers @@ -11,6 +12,7 @@ Translation Managers * Henri Colas (@NotSqrt) * Danilo Bargen (@dbrgn) +* Asif Saif Uddin (@auvipy) Developers ---------- diff --git a/README.rst b/README.rst index ba52145..8f10652 100644 --- a/README.rst +++ b/README.rst @@ -47,8 +47,8 @@ Screenshots Requirements ============ -* Django 1.7+ -* Python 2.7+ or Python 3.3+ +* Django 1.11+ +* Python 2.7+ or Python 3.4+ * django-braces_ * django-extra-views_ * django-rest-framework_ diff --git a/djadmin2/core.py b/djadmin2/core.py index 1d29aa9..d9dc280 100644 --- a/djadmin2/core.py +++ b/djadmin2/core.py @@ -8,7 +8,7 @@ from __future__ import division, absolute_import, unicode_literals from importlib import import_module from django.conf import settings -from django.conf.urls import include, url +from django.conf.urls import url from django.core.exceptions import ImproperlyConfigured from . import apiviews @@ -195,11 +195,11 @@ class Admin2(object): url('^{}/{}/'.format( model_options.app_label, model_options.object_name.lower()), - include(model_admin.urls)), + model_admin.urls), url('^api/v0/{}/{}/'.format( model_options.app_label, model_options.object_name.lower()), - include(model_admin.api_urls)), + model_admin.api_urls), ] return urlpatterns diff --git a/djadmin2/migrations/0001_initial.py b/djadmin2/migrations/0001_initial.py index 3931cd3..f3030bc 100644 --- a/djadmin2/migrations/0001_initial.py +++ b/djadmin2/migrations/0001_initial.py @@ -22,8 +22,16 @@ class Migration(migrations.Migration): ('object_repr', models.CharField(max_length=200, verbose_name='object repr')), ('action_flag', models.PositiveSmallIntegerField(verbose_name='action flag')), ('change_message', models.TextField(verbose_name='change message', blank=True)), - ('content_type', models.ForeignKey(related_name='log_entries', null=True, blank=True, to='contenttypes.ContentType')), - ('user', models.ForeignKey(related_name='log_entries', to=settings.AUTH_USER_MODEL)), + ('content_type', models.ForeignKey( + related_name='log_entries', + null=True, + blank=True, + to='contenttypes.ContentType', + on_delete=models.CASCADE)), + ('user', models.ForeignKey( + related_name='log_entries', + to=settings.AUTH_USER_MODEL, + on_delete=models.CASCADE)), ], options={ 'verbose_name': 'log entry', diff --git a/djadmin2/permissions.py b/djadmin2/permissions.py index 8bbee29..e9371a2 100644 --- a/djadmin2/permissions.py +++ b/djadmin2/permissions.py @@ -35,7 +35,7 @@ def is_authenticated(request, view, obj=None): ''' Checks if the current user is authenticated. ''' - return request.user.is_authenticated() + return request.user.is_authenticated def is_staff(request, view, obj=None): diff --git a/djadmin2/tests/urls.py b/djadmin2/tests/urls.py index f2b520d..283ce87 100644 --- a/djadmin2/tests/urls.py +++ b/djadmin2/tests/urls.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.conf.urls import include, url +from django.conf.urls import url from django.conf.urls.static import static from djadmin2.site import djadmin2_site @@ -17,5 +17,5 @@ djadmin2_site.login_view = CustomLoginView djadmin2_site.autodiscover() urlpatterns = [ - url(r'^admin2/', include(djadmin2_site.urls)), + url(r'^admin2/', djadmin2_site.urls), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/example/blog/migrations/0001_initial.py b/example/blog/migrations/0001_initial.py index 6761aea..a063401 100644 --- a/example/blog/migrations/0001_initial.py +++ b/example/blog/migrations/0001_initial.py @@ -27,7 +27,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)), ('num', models.PositiveSmallIntegerField()), - ('parent', models.ForeignKey(to='blog.Count', null=True)), + ('parent', models.ForeignKey( + to='blog.Count', null=True, on_delete=models.CASCADE)), ], ), migrations.CreateModel( @@ -49,7 +50,9 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)), ('name', models.CharField(max_length=255)), - ('event', models.OneToOneField(to='blog.Event')), + ('event', models.OneToOneField( + to='blog.Event', + on_delete=models.CASCADE)), ], options={ 'verbose_name': 'awesome guest', @@ -59,7 +62,10 @@ class Migration(migrations.Migration): name='Location', fields=[ ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)), - ('event', models.OneToOneField(verbose_name='awesome event', to='blog.Event')), + ('event', models.OneToOneField( + verbose_name='awesome event', + to='blog.Event', + on_delete=models.CASCADE)), ], ), migrations.CreateModel( @@ -79,6 +85,10 @@ class Migration(migrations.Migration): migrations.AddField( model_name='comment', name='post', - field=models.ForeignKey(related_name='comments', verbose_name='post', to='blog.Post'), + field=models.ForeignKey( + related_name='comments', + verbose_name='post', + to='blog.Post', + on_delete=models.CASCADE), ), ] diff --git a/example/example/settings.py b/example/example/settings.py index e42013d..3b5ecec 100644 --- a/example/example/settings.py +++ b/example/example/settings.py @@ -56,7 +56,6 @@ MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] @@ -66,7 +65,7 @@ ROOT_URLCONF = 'example.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ diff --git a/example/example/urls.py b/example/example/urls.py index d302b8d..eb45787 100644 --- a/example/example/urls.py +++ b/example/example/urls.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from blog.views import BlogListView, BlogDetailView from django.conf import settings -from django.conf.urls import include, url +from django.conf.urls import url from django.conf.urls.static import static from django.contrib import admin @@ -12,8 +12,8 @@ from djadmin2.site import djadmin2_site djadmin2_site.autodiscover() urlpatterns = [ - url(r'^admin2/', include(djadmin2_site.urls)), - url(r'^admin/', include(admin.site.urls)), + url(r'^admin2/', djadmin2_site.urls), + url(r'^admin/', admin.site.urls), url(r'^blog/', BlogListView.as_view(template_name="blog/blog_list.html"), name='blog_list'), url(r'^blog/detail(?P\d+)/$', diff --git a/example/files/tests/test_views.py b/example/files/tests/test_views.py index 6751c6a..0d743a0 100644 --- a/example/files/tests/test_views.py +++ b/example/files/tests/test_views.py @@ -1,7 +1,7 @@ from os import path from django.contrib.auth import get_user_model -from django.core.urlresolvers import reverse +from django.urls import reverse from django.test import TestCase, Client from django.utils.encoding import force_text diff --git a/example/polls/migrations/0001_initial.py b/example/polls/migrations/0001_initial.py index 21980fd..8dd792e 100644 --- a/example/polls/migrations/0001_initial.py +++ b/example/polls/migrations/0001_initial.py @@ -37,6 +37,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='choice', name='poll', - field=models.ForeignKey(verbose_name='poll', to='polls.Poll'), + field=models.ForeignKey( + verbose_name='poll', + to='polls.Poll', + on_delete=models.CASCADE), ), ] diff --git a/example/polls/tests/test_views.py b/example/polls/tests/test_views.py index 67ab56a..a2bcc65 100644 --- a/example/polls/tests/test_views.py +++ b/example/polls/tests/test_views.py @@ -1,6 +1,6 @@ from django.contrib.auth import get_user_model -from django.core.urlresolvers import reverse from django.test import TestCase, Client +from django.urls import reverse from django.utils import timezone from django.utils.encoding import force_text diff --git a/setup.py b/setup.py index 15b1142..9db8c1d 100644 --- a/setup.py +++ b/setup.py @@ -81,6 +81,7 @@ if sys.argv[-1] == 'publish': LONG_DESCRIPTION = remove_screenshots(open('README.rst').read()) HISTORY = open('HISTORY.rst').read() + class PyTest(TestCommand): user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] @@ -100,6 +101,7 @@ class PyTest(TestCommand): errno = pytest.main(self.pytest_args) sys.exit(errno) + setup( name='django-admin2', version=version, @@ -113,7 +115,9 @@ setup( "Operating System :: OS Independent", "Programming Language :: JavaScript", "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules", @@ -127,12 +131,12 @@ setup( include_package_data=True, #test_suite='runtests.runtests', install_requires=[ - 'django>=1.8.0', - 'django-extra-views==0.8.0', + 'django>=1.11.1', + 'django-extra-views>=0.11.0', 'django-braces>=1.3.0', - 'djangorestframework<=3.5.3', - 'django-filter==1.0.0', - 'pytz==2016.4', + 'djangorestframework>=3.8.2', + 'django-filter==1.1.0', + 'pytz>=2016.4', 'future>=0.15.2', ], extras_require={ diff --git a/tox.ini b/tox.ini index 07ab3cc..df0d23d 100644 --- a/tox.ini +++ b/tox.ini @@ -6,9 +6,9 @@ exclude = migrations/*,docs/* [tox] envlist = - py27-{1.10,1.11}, - py34-{1.10,1.11,2.0}, - py35-{1.10,1.11,2.0,master}, + py27-{1.11}, + py35-{1.11,2.0,2.1}, + py36-{2.0,2.1,master}, [testenv] commands = @@ -16,7 +16,7 @@ commands = py.test [] deps = -rrequirements_test.txt - 1.10: Django>=1.10,<1.11 + 2.1: Django>=2.1,<2.2 1.11: Django>=1.11,<2.0 2.0: Django>=2.0,<2.1 master: https://github.com/django/django/tarball/master