Revised the IsBalanced validator so that it no longer need the __future__ annotation.
This commit is contained in:
parent
8e219d8006
commit
f6946c1165
@ -17,8 +17,6 @@
|
|||||||
"""The currency sub-forms for the transaction management.
|
"""The currency sub-forms for the transaction management.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from flask_babel import LazyString
|
from flask_babel import LazyString
|
||||||
@ -62,8 +60,9 @@ class IsBalanced:
|
|||||||
"""The validator to check that the total amount of the debit and credit
|
"""The validator to check that the total amount of the debit and credit
|
||||||
entries are equal."""
|
entries are equal."""
|
||||||
|
|
||||||
def __call__(self, form: TransferCurrencyForm, field: BooleanField)\
|
def __call__(self, form: FlaskForm, field: BooleanField) -> None:
|
||||||
-> None:
|
if not isinstance(form, TransferCurrencyForm):
|
||||||
|
return
|
||||||
if len(form.debit) == 0 or len(form.credit) == 0:
|
if len(form.debit) == 0 or len(form.credit) == 0:
|
||||||
return
|
return
|
||||||
if form.debit_total != form.credit_total:
|
if form.debit_total != form.credit_total:
|
||||||
|
Loading…
Reference in New Issue
Block a user