mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-29 09:52:36 +02:00
Fixed billtype displaying in all caps
This commit is contained in:
parent
bf9601377d
commit
49286448ec
3 changed files with 8 additions and 3 deletions
|
@ -364,7 +364,7 @@ class BillForm(FlaskForm):
|
||||||
payed_for = SelectMultipleField(
|
payed_for = SelectMultipleField(
|
||||||
_("For whom?"), validators=[DataRequired()], coerce=int
|
_("For whom?"), validators=[DataRequired()], coerce=int
|
||||||
)
|
)
|
||||||
bill_type = SelectField(_("Bill Type"), validators=[DataRequired()], choices=BillType.choices())
|
bill_type = SelectField(_("Bill Type"), validators=[DataRequired()], choices=BillType.choices(), coerce=BillType)
|
||||||
submit = SubmitField(_("Submit"))
|
submit = SubmitField(_("Submit"))
|
||||||
submit2 = SubmitField(_("Submit and add a new one"))
|
submit2 = SubmitField(_("Submit and add a new one"))
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from enum import Enum
|
||||||
import datetime
|
import datetime
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
|
@ -50,11 +51,15 @@ make_versioned(
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
class BillType(FormEnum):
|
class BillType(Enum):
|
||||||
EXPENSE = "Expense"
|
EXPENSE = "Expense"
|
||||||
REIMBURSEMENT = "Reimbursement"
|
REIMBURSEMENT = "Reimbursement"
|
||||||
TRANSFER = "Transfer"
|
TRANSFER = "Transfer"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def choices(cls):
|
||||||
|
return [(choice, choice.value) for choice in cls]
|
||||||
|
|
||||||
|
|
||||||
db = SQLAlchemy()
|
db = SQLAlchemy()
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
{{ bill.date }}
|
{{ bill.date }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ bill.bill_type }}</td>
|
<td>{{ bill.bill_type.value }}</td>
|
||||||
<td>{{ bill.payer }}</td>
|
<td>{{ bill.payer }}</td>
|
||||||
<td>{{ bill.what }}</td>
|
<td>{{ bill.what }}</td>
|
||||||
<td>{% if bill.owers|length == g.project.members|length -%}
|
<td>{% if bill.owers|length == g.project.members|length -%}
|
||||||
|
|
Loading…
Reference in a new issue