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(*args, **kwargs)¶
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, renderer=None)¶
A form for managing transactions with an arbitrary number of legs.
You will almost certainly need to combine this with
LegFormSet
in 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¶
Optional description/notes for this transaction
- Type:
forms.CharField
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¶
Choose an account the leg will interact with
- Type:
TreeNodeChoiceField
- description¶
Optional description/notes for this leg
- Type:
forms.CharField
- amount¶
The amount for this leg. Positive values indicate money coming into the transaction, negative values indicate money leaving the transaction.
- Type:
MoneyField
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.