Use sa-filters instead of sqlalchemy-filters for API queries
latter was abandoned it seems; former has support for SQLAlchemy 1.4 and looks to be a drop-in replacement another option, if needed at some point, though i like the looks of it less, is https://sqlalchemy-filters-plus.readthedocs.io/ see also: https://github.com/juliotrigo/sqlalchemy-filters/pull/69 https://github.com/juliotrigo/sqlalchemy-filters/issues/72
This commit is contained in:
parent
c87c50bfb9
commit
5736faf24c
2
setup.py
2
setup.py
|
@ -96,7 +96,7 @@ requires = [
|
||||||
'pyramid_tm', # 0.3
|
'pyramid_tm', # 0.3
|
||||||
'rattail[db,bouncer]', # 0.5.0
|
'rattail[db,bouncer]', # 0.5.0
|
||||||
'six', # 1.10.0
|
'six', # 1.10.0
|
||||||
'sqlalchemy-filters', # 0.8.0
|
'sa-filters', # 1.2.0
|
||||||
'transaction', # 1.2.0
|
'transaction', # 1.2.0
|
||||||
'waitress', # 0.8.1
|
'waitress', # 0.8.1
|
||||||
'WebHelpers2', # 2.0
|
'WebHelpers2', # 2.0
|
||||||
|
|
|
@ -24,12 +24,8 @@
|
||||||
Tailbone Web API - Master View
|
Tailbone Web API - Master View
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import unicode_literals, absolute_import
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from rattail.config import parse_bool
|
from rattail.config import parse_bool
|
||||||
from rattail.db.util import get_fieldnames
|
from rattail.db.util import get_fieldnames
|
||||||
|
|
||||||
|
@ -279,7 +275,7 @@ class APIMasterView(APIView):
|
||||||
return self._fieldnames
|
return self._fieldnames
|
||||||
|
|
||||||
def normalize(self, obj):
|
def normalize(self, obj):
|
||||||
data = {'_str': six.text_type(obj)}
|
data = {'_str': str(obj)}
|
||||||
|
|
||||||
for field in self.get_fieldnames():
|
for field in self.get_fieldnames():
|
||||||
data[field] = getattr(obj, field)
|
data[field] = getattr(obj, field)
|
||||||
|
@ -287,7 +283,7 @@ class APIMasterView(APIView):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def _collection_get(self):
|
def _collection_get(self):
|
||||||
from sqlalchemy_filters import apply_filters, apply_sort, apply_pagination
|
from sa_filters import apply_filters, apply_sort, apply_pagination
|
||||||
|
|
||||||
query = self.base_query()
|
query = self.base_query()
|
||||||
context = {}
|
context = {}
|
||||||
|
|
Loading…
Reference in a new issue