Skip to content

Commit

Permalink
Merge pull request #2574 from pallets-eco/fix/packaging-wtforms
Browse files Browse the repository at this point in the history
Don't use packaging for wtforms version check
  • Loading branch information
samuelhwilliams authored Nov 22, 2024
2 parents aad1b87 + 4d20a8d commit 5caec1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changelog
Fixes:

* Jinja templates can now be loaded in StrictUndefined mode.
* Remove an implicit dependency on `packaging`

2.0.0a2
-------
Expand Down
5 changes: 2 additions & 3 deletions flask_admin/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@ def _iter_choices_wtforms_compat(val, label, selected):
https://wtforms.readthedocs.io/en/3.2.x/changes/#version-3-2-0
"""
from packaging.version import Version
import wtforms

wtforms_version = Version(wtforms.__version__)
wtforms_version = tuple(int(part) for part in wtforms.__version__.split(".")[:2])

if wtforms_version >= Version("3.2.0"):
if wtforms_version >= (3, 2):
return val, label, selected, {}

return val, label, selected

0 comments on commit 5caec1e

Please sign in to comment.