mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-06 05:01:48 +02:00
more comments
This commit is contained in:
parent
c0796c1ebf
commit
5176f1950a
1 changed files with 6 additions and 2 deletions
|
@ -112,8 +112,12 @@ class EditProjectForm(FlaskForm):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
if not hasattr(self, "id"):
|
if not hasattr(self, "id"):
|
||||||
# We must access the project to validate the default currency.
|
# We must access the project to validate the default currency, using its id.
|
||||||
# Mimics a StringField. Defaut to empty string to ensure that query run smoothly.
|
# In ProjectForm, 'id' is provided, but not in this base class, so it *must*
|
||||||
|
# be provided by callers.
|
||||||
|
# Since id can be defined as a WTForms.StringField, we mimics it,
|
||||||
|
# using an object that can have a 'data' attribute.
|
||||||
|
# It defaults to empty string to ensure that query run smoothly.
|
||||||
self.id = SimpleNamespace(data=kwargs.pop("id", ""))
|
self.id = SimpleNamespace(data=kwargs.pop("id", ""))
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.default_currency.choices = [
|
self.default_currency.choices = [
|
||||||
|
|
Loading…
Reference in a new issue