From 6464b6de059f7cf96768ce269b8a002cbafe1368 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 13 Feb 2023 21:02:59 +0000 Subject: [PATCH] Filter for enabled accounts --- core/forms.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/forms.py b/core/forms.py index b0f9231..418b6b4 100644 --- a/core/forms.py +++ b/core/forms.py @@ -113,6 +113,11 @@ class StrategyForm(RestrictedFormMixin, ModelForm): "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: model = Strategy fields = (