./manage.py makemigrations
System check identified some issues:
WARNINGS:
hordak.Account.currencies: (fields.E010) ArrayField default should be a callable instead of an instance so that it's not shared between all field instances.
HINT: Use a callable instead, e.g., use `list` instead of `[]`.
Now the warning disappears, yay! But now that it is a callable function instead of an iterable, this breaks:
# https://github.com/adamcharnock/django-hordak/blob/master/hordak/forms/transactions.py#L46
if code == default_currency or code in CURRENCIES
A quick test (i'm pretty new, so needed to manually test):
>>> def currencies():
... return ["SGD", "IDR"]
...
>>> currencies()
['SGD', 'IDR']
>>> 'SGD' in currencies
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: argument of type 'function' is not iterable
Thanks for this great repo! Continuing my journey to using this. This is very low priority.
Based on the documentation for
CURRENCIES
the form is supposed to be:But when I do this I get the warning:
Which then leads me to change CURRENCIES:
Now the warning disappears, yay! But now that it is a callable function instead of an iterable, this breaks:
A quick test (i'm pretty new, so needed to manually test):
Any recommendation around this warning?