flexmeasures.ui.views.assets.forms

Classes

class flexmeasures.ui.views.assets.forms.AssetForm(*args, **kwargs)

The default asset form only allows to edit the name and location.

process_api_validation_errors(api_response: dict)

Process form errors from the API for the WTForm

to_json() dict

turn form data into a JSON we can POST to our internal API

validate_on_submit()

Call validate() only if the form is submitted. This is a shortcut for form.is_submitted() and form.validate().

class flexmeasures.ui.views.assets.forms.NewAssetForm(*args, **kwargs)

Here, in addition, we allow to set asset type and account.

set_account() tuple[Account | None, str | None]

Set an account for the to-be-created asset. Return the account (if available) and an error message

set_asset_type() tuple[GenericAssetType | None, str | None]

Set an asset type for the to-be-created asset. Return the asset type (if available) and an error message.