diff --git a/Makefile b/Makefile index ba5cddc..7519626 100644 --- a/Makefile +++ b/Makefile @@ -33,9 +33,6 @@ test_no_coverage: tox: @tox -#docs: - #@cd django_paynova/docs && make html && open _build/html/index.html - register: @python setup.py sdist register diff --git a/README.md b/README.md index 0060a71..b59d7a1 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This package provides management command `cleanup_unused_media` for Django appli ``` pip install django-unused-media ``` - Python 2.7, 3.3, 3.4, 3.5, PyPy are tested with tox. + Python 2.7, 3.5, PyPy are tested with tox. Django 1.6, 1.7, 1.8, 1.9 are tested with tox. diff --git a/django_unused_media/cleanup.py b/django_unused_media/cleanup.py index e045ace..b1821e8 100644 --- a/django_unused_media/cleanup.py +++ b/django_unused_media/cleanup.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from django.db import models +from django.apps import apps from django.conf import settings import os @@ -12,9 +13,18 @@ def _get_file_fields(): Get all fields which are inherited from FileField """ + # get models. Compatibility with 1.6 + + if getattr(apps, 'get_models'): + all_models = apps.get_models() + else: + all_models = models.get_models() + + # get fields + fields = [] - for m in models.get_models(): + for m in all_models: for f in m._meta.get_fields(): if isinstance(f, models.FileField): fields.append(f) diff --git a/setup.py b/setup.py index 800f642..11cf6ec 100755 --- a/setup.py +++ b/setup.py @@ -24,17 +24,14 @@ 'yanc', 'preggy', 'tox<2.0', - 'ipdb', 'coveralls', - 'sphinx', 'django_nose', - 'httmock', 'pypandoc', ] setup( name='django-unused-media', - version='0.1.3', + version='0.1.4', description='Delete unused media files from Django project', long_description=read_md('README.md'), keywords='python django unused media remove delete', @@ -49,7 +46,9 @@ 'Natural Language :: English', 'Operating System :: Unix', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: Implementation :: PyPy', 'Operating System :: OS Independent', ], @@ -58,7 +57,7 @@ install_requires=[ # add your dependencies here # remember to use 'package-name>=x.y.z,=1.6,<1.9', + 'django>=1.6,<1.10', 'six', ], extras_require={ diff --git a/tox.ini b/tox.ini index 1e26131..90dc17b 100644 --- a/tox.ini +++ b/tox.ini @@ -11,14 +11,6 @@ envlist = py27-1.7.X, py27-1.8.X, py27-1.9.X, - py33-1.6.X, - py33-1.7.X, - py33-1.8.X, - py33-1.9.X, - py34-1.6.X, - py34-1.7.X, - py34-1.8.X, - py34-1.9.X, py35-1.6.X, py35-1.7.X, py35-1.8.X, @@ -61,70 +53,6 @@ commands = deps = Django>=1.9,<1.10 -[testenv:py33-1.6.X] -basepython = python3.3 -commands = - make setup - make test_no_coverage -deps = - Django>=1.6,<1.7 - -[testenv:py33-1.7.X] -basepython = python3.3 -commands = - make setup - make test_no_coverage -deps = - Django>=1.7,<1.8 - -[testenv:py33-1.8.X] -basepython = python3.3 -commands = - make setup - make test_no_coverage -deps = - Django>=1.8,<1.9 - -[testenv:py33-1.9.X] -basepython = python3.3 -commands = - make setup - make test_no_coverage -deps = - Django>=1.9,<1.10 - -[testenv:py34-1.6.X] -basepython = python3.4 -commands = - make setup - make test_no_coverage -deps = - Django>=1.6,<1.7 - -[testenv:py34-1.7.X] -basepython = python3.4 -commands = - make setup - make test_no_coverage -deps = - Django>=1.7,<1.8 - -[testenv:py34-1.8.X] -basepython = python3.4 -commands = - make setup - make test_no_coverage -deps = - Django>=1.8,<1.9 - -[testenv:py34-1.9.X] -basepython = python3.4 -commands = - make setup - make test_no_coverage -deps = - Django>=1.9,<1.10 - [testenv:py35-1.6.X] basepython = python3.5 commands =