Forms#
The coins app provides a single user-facing form – the
coin creation / edit form. It is one of the per-app
subclasses of BaseUserItemForm (see
Forms, fields and widgets), narrowed to Coin, with
an extra coin_id field and cross-field validation that
disambiguates colliding ticker symbols against
CoinGecko via the
Karpet library.
UserCoinForm#
Concrete coin variant of
BaseUserItemForm. Sets
item_model = Coin. The extra coin_id field carries
the unambiguous CoinGecko slug (see
Coins). On edit, both symbol and
coin_id are rendered read-only so the asset identity
cannot change after creation.
The form-level clean() performs the
symbol-disambiguation handshake:
If the user did not enter a
coin_idand the symbol resolves to more than one slug, the form raises a validation error asking for an explicitcoin_id.If the symbol resolves to nothing – or the entered
coin_idis not among the slugs found – the form raises a “Coin ID wasn’t found.” error.
- class richy.coins.forms.UserCoinForm(user, *args, **kwargs)[source]#
Bases:
BaseUserItemForm