Skip to content

Commit

Permalink
Remove SQLAlchemy < 1.4 imports and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmayo committed Oct 20, 2023
1 parent 5785032 commit 44aafbb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion flask_admin/contrib/sqla/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ def apply(self, query, value, alias=None):
class DateNotBetweenFilter(DateBetweenFilter):
def apply(self, query, value, alias=None):
start, end = value
# ~between() isn't possible until sqlalchemy 1.0.0
return query.filter(not_(self.get_column(alias).between(start, end)))

def operation(self):
Expand Down
9 changes: 2 additions & 7 deletions flask_admin/contrib/sqla/tools.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import types

from sqlalchemy import tuple_, or_, and_, inspect
try:
# Attempt _class_resolver import from SQLALchemy 1.4/2.0 module architecture.
from sqlalchemy.orm.clsregistry import _class_resolver
except ImportError:
# If 1.4/2.0 module import fails, fall back to <1.3.x architecture.
from sqlalchemy.ext.declarative.clsregistry import _class_resolver
from sqlalchemy.orm.clsregistry import _class_resolver
from sqlalchemy.ext.hybrid import hybrid_property
try:
# Attempt ASSOCATION_PROXY import from pre-2.0 release
from sqlalchemy.ext.associationproxy import ASSOCIATION_PROXY
except ImportError:
# SQLAlchemy 2.0
from sqlalchemy.ext.associationproxy import AssociationProxyExtensionType
ASSOCIATION_PROXY = AssociationProxyExtensionType.ASSOCIATION_PROXY
from sqlalchemy.sql.operators import eq
Expand Down

0 comments on commit 44aafbb

Please sign in to comment.