diff --git a/.travis.yml b/.travis.yml index d794ea4..9bbeb7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,39 @@ language: python -python: - - 2.7 - - 3.4 - - 3.5 sudo: false -env: - - DJANGO_VERSION_CEILING=1.11 DJANGO_DB_ENGINE=sqlite - - DJANGO_VERSION_CEILING=1.11 DJANGO_DB_ENGINE=postgres DJANGO_DB_NAME=testdb DJANGO_DB_USER=postgres - - DJANGO_VERSION_CEILING=1.11 DJANGO_DB_ENGINE=mysql DJANGO_DB_NAME=testdb DJANGO_DB_USER=travis - - DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=sqlite - - DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=postgres DJANGO_DB_NAME=testdb DJANGO_DB_USER=postgres - - DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=mysql DJANGO_DB_NAME=testdb DJANGO_DB_USER=travis + +matrix: + include: + - python: 2.7 + env: DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=sqlite + - python: 2.7 + env: DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=postgres DJANGO_DB_NAME=testdb DJANGO_DB_USER=postgres + - python: 2.7 + env: DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=mysql DJANGO_DB_NAME=testdb DJANGO_DB_USER=travis + - python: 3.5 + env: DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=sqlite + - python: 3.5 + env: DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=postgres DJANGO_DB_NAME=testdb DJANGO_DB_USER=postgres + - python: 3.5 + env: DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=mysql DJANGO_DB_NAME=testdb DJANGO_DB_USER=travis + - python: 3.5 + env: DJANGO_VERSION_CEILING=2.1 DJANGO_DB_ENGINE=sqlite + - python: 3.5 + env: DJANGO_VERSION_CEILING=2.1 DJANGO_DB_ENGINE=postgres DJANGO_DB_NAME=testdb DJANGO_DB_USER=postgres + - python: 3.5 + env: DJANGO_VERSION_CEILING=2.1 DJANGO_DB_ENGINE=mysql DJANGO_DB_NAME=testdb DJANGO_DB_USER=travis + - python: 3.6 + env: DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=sqlite + - python: 3.6 + env: DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=postgres DJANGO_DB_NAME=testdb DJANGO_DB_USER=postgres + - python: 3.6 + env: DJANGO_VERSION_CEILING=1.12 DJANGO_DB_ENGINE=mysql DJANGO_DB_NAME=testdb DJANGO_DB_USER=travis + - python: 3.6 + env: DJANGO_VERSION_CEILING=2.1 DJANGO_DB_ENGINE=sqlite + - python: 3.6 + env: DJANGO_VERSION_CEILING=2.1 DJANGO_DB_ENGINE=postgres DJANGO_DB_NAME=testdb DJANGO_DB_USER=postgres + - python: 3.6 + env: DJANGO_VERSION_CEILING=2.1 DJANGO_DB_ENGINE=mysql DJANGO_DB_NAME=testdb DJANGO_DB_USER=travis + install: - pip install "Django<$DJANGO_VERSION_CEILING" mysqlclient psycopg2 - "pip install flake8 pylint pylint-django django-nose" diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ea0ec87..a71c709 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,15 @@ Changelog ========= +3.0.0 +------------------ + - Add support for Python 3.6 + - Add support for Django 2.0 + - Remove support for Python 3.4 + - Remove support for old Django versions + - Remove GIS + + 2.5.0 (Not released) ------------------ - Added official Python 3 support. diff --git a/setup.py b/setup.py index f5c6fbe..8a61cab 100755 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ install_requires = ( - 'Django>=1.10', + 'Django>=1.11,<2.1', ) @@ -70,7 +70,7 @@ def run_tests(self): setup( name='django-livefield', - version='2.8.0', + version='3.0.0', description='Convenient soft-deletion support for Django models', long_description=( open('README.rst').read() + '\n\n' + @@ -84,9 +84,8 @@ def run_tests(self): 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', ], keywords='python django soft-delete', url='https://github.com/hearsaycorp/django-livefield', diff --git a/src/livefield/gis/__init__.py b/src/livefield/gis/__init__.py deleted file mode 100644 index 16780ef..0000000 --- a/src/livefield/gis/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from .managers import LiveGeoManager -from .models import LiveGeoModel -from .querysets import LiveGeoQuerySet - - -__all__ = [ - "LiveGeoManager", - "LiveGeoModel", - "LiveGeoQuerySet", -] diff --git a/src/livefield/gis/managers.py b/src/livefield/gis/managers.py deleted file mode 100644 index 8ceffa0..0000000 --- a/src/livefield/gis/managers.py +++ /dev/null @@ -1,20 +0,0 @@ -from django.db import models -from .querysets import LiveGeoQuerySet - - -class LiveGeoManagerBase(models.Manager): - # To also use this manager for FK lookups, see - # https://docs.djangoproject.com/en/1.6/topics/db/managers/#manager-types. - - def __init__(self, include_soft_deleted=False, *args, **kwargs): - self.include_soft_deleted = include_soft_deleted - super(LiveGeoManagerBase, self).__init__(*args, **kwargs) # pylint: disable=super-on-old-class - - def get_queryset(self): - qs = super(LiveGeoManagerBase, self).get_queryset() # pylint: disable=super-on-old-class - if not self.include_soft_deleted: - return qs.live() - return qs - - -LiveGeoManager = LiveGeoManagerBase.from_queryset(LiveGeoQuerySet) diff --git a/src/livefield/gis/models.py b/src/livefield/gis/models.py deleted file mode 100644 index 92b23c0..0000000 --- a/src/livefield/gis/models.py +++ /dev/null @@ -1,32 +0,0 @@ -from django.contrib.gis.db.models import Model as GeoModel - -from ..fields import LiveField -from .managers import LiveGeoManager - - -class LiveGeoModel(GeoModel): - """GeoModel support for soft-deleting using LiveField. - - LiveModel overrides Model.delete() to provide soft-deletion via - a LiveField. `.delete()` updates `Model.live` to `True`. Normal - deletion can performed usign `Model.hard_delete()`. - """ - - live = LiveField() - - objects = LiveGeoManager() - all_objects = LiveGeoManager(include_soft_deleted=True) - - class Meta: - abstract = True - - def delete(self, *args, **kwargs): - self.live = False - self.save() - - def hard_delete(self): # pylint: disable=super-on-old-class - super(LiveGeoModel, self).delete() - - def undelete(self, *args, **kwargs): - self.live = True - self.save() diff --git a/src/livefield/gis/querysets.py b/src/livefield/gis/querysets.py deleted file mode 100644 index 499e78a..0000000 --- a/src/livefield/gis/querysets.py +++ /dev/null @@ -1,27 +0,0 @@ -from django.contrib.gis.db.models.query import GeoQuerySet - - -class LiveGeoQuerySet(GeoQuerySet): - - def delete(self): - # Override Django's built-in default. - self.soft_delete() - - def soft_delete(self): - self.update(live=False) - - def undelete(self): - self.update(live=True) - - def hard_delete(self): - # Default Django behavior. - super(LiveGeoQuerySet, self).delete() - - def live(self): - return self.filter(live=True) - - def non_dead(self): - return self.live() - - def dead(self): - return self.filter(live__isnull=True)