Fixed order_by

This commit is contained in:
Syrus Akbary 2016-11-23 01:01:32 -08:00
parent d8567f1c58
commit 48993ddca0
2 changed files with 8 additions and 7 deletions

View File

@ -22,8 +22,9 @@ before_install:
install:
- |
if [ "$TEST_TYPE" = build ]; then
pip install pytest==3.0.2 pytest-cov pytest-benchmark coveralls six pytest-django==2.9.1 mock django-filter
pip install django==$DJANGO_VERSION
pip install pytest==3.0.2 pytest-cov pytest-benchmark coveralls six pytest-django==2.9.1 mock
pip install django==$DJANGO_FILTER_VERSION
pip install -e .
python setup.py develop
elif [ "$TEST_TYPE" = lint ]; then
@ -45,18 +46,18 @@ after_success:
fi
env:
matrix:
- TEST_TYPE=build
- TEST_TYPE=build DJANGO_VERSION=1.10 DJANGO_FILTER_VERSION=1.0.0
matrix:
fast_finish: true
include:
- python: '2.7'
env: TEST_TYPE=build DJANGO_VERSION=1.6
env: TEST_TYPE=build DJANGO_VERSION=1.6 DJANGO_FILTER_VERSION=0.15.3
- python: '2.7'
env: TEST_TYPE=build DJANGO_VERSION=1.7
env: TEST_TYPE=build DJANGO_VERSION=1.7 DJANGO_FILTER_VERSION=0.15.3
- python: '2.7'
env: TEST_TYPE=build DJANGO_VERSION=1.8
env: TEST_TYPE=build DJANGO_VERSION=1.8 DJANGO_FILTER_VERSION=0.15.3
- python: '2.7'
env: TEST_TYPE=build DJANGO_VERSION=1.9
env: TEST_TYPE=build DJANGO_VERSION=1.9 DJANGO_FILTER_VERSION=1.0.0
- python: '2.7'
env: TEST_TYPE=lint
deploy:

View File

@ -19,7 +19,7 @@ def get_filtering_args_from_filterset(filterset_class, type):
args[name] = field_type
# Also add the 'order_by' field
if filterset_class._meta.order_by:
if getattr(filterset_class._meta, 'order_by', None):
args[filterset_class.order_by_field] = String()
return args