Added documentation to the from_post method of TransactionFrom in the accounting application.

This commit is contained in:
依瑪貓 2020-08-19 13:46:46 +08:00
parent 790e8da908
commit 759e7262fb

View File

@ -237,6 +237,16 @@ class TransactionForm(forms.Form):
@staticmethod
def from_post(post: Dict[str, str], txn_type: str, txn: Model):
"""Constructs a transaction form from the POST data.
Args:
post: The post data.
txn_type: The transaction type.
txn: The transaction data model.
Returns:
The transaction form.
"""
TransactionForm._sort_post_txn_records(post)
form = TransactionForm(post)
form.txn_type = txn_type