Forms¶
As with views, Hordak provides a number of off-the-shelf forms. You may need to implement your own version of (or extend) these forms in order to provide customised functionality.
SimpleTransactionForm¶
-
class
hordak.forms.SimpleTransactionForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)¶ A simplified form for transferring an an amount from one account to another
This only allows the creation of transactions with two legs. This also uses
Account.transfer_to().See also
TransactionForm¶
-
class
hordak.forms.TransactionForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)¶ A form for managing transactions with an arbitrary number of legs.
You will almost certainly need to combine this with
LegFormSetin order to create & edit transactions.Note
For simple transactions (with a single credit and single debit) you a probably better of using the
SimpleTransactionForm. This significantly simplifies both the interface and implementation.-
description¶ forms.CharField – Optional description/notes for this transaction
See also
This is a ModelForm for the
Transaction model.-
LegForm¶
-
class
hordak.forms.LegForm(*args, **kwargs)¶ A form for representing a single transaction leg
-
account¶ TreeNodeChoiceField – Choose an account the leg will interact with
-
description¶ forms.CharField – Optional description/notes for this leg
-
amount¶ MoneyField – The amount for this leg. Positive values indicate money coming into the transaction, negative values indicate money leaving the transaction.
See also
This is a ModelForm for the
Leg model.-
LegFormSet¶
A formset which can be used to display multiple Leg forms.
Useful when creating transactions.