Skip to content

Commit

Permalink
compatibility with Django 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
akolpakov committed Apr 2, 2016
1 parent d901b10 commit ce9f05b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 82 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 11 additions & 1 deletion django_unused_media/cleanup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

from django.db import models
from django.apps import apps
from django.conf import settings

import os
Expand All @@ -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)
Expand Down
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
],
Expand All @@ -58,7 +57,7 @@
install_requires=[
# add your dependencies here
# remember to use 'package-name>=x.y.z,<x.y+1.0' notation (this way you get bugfixes)
'django>=1.6,<1.9',
'django>=1.6,<1.10',
'six',
],
extras_require={
Expand Down
72 changes: 0 additions & 72 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit ce9f05b

Please sign in to comment.