Filter for enabled accounts

This commit is contained in:
Mark Veidemanis 2023-02-13 21:02:59 +00:00
parent 6ff5f718ba
commit 6464b6de05
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 5 additions and 0 deletions

View File

@ -113,6 +113,11 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
"trend_signals": {"type": "trend"}, "trend_signals": {"type": "trend"},
} }
# Filter for enabled accounts
def __init__(self, *args, **kwargs):
super(StrategyForm, self).__init__(*args, **kwargs)
self.fields["account"].queryset = Account.objects.filter(enabled=True)
class Meta: class Meta:
model = Strategy model = Strategy
fields = ( fields = (