Oh this worked out beautifully! Not sure why it hadn’t occurred to me to call
super().__init__ before hand. And manipulating self.fields was the farthest
thing from my mind.
As for using ModelMultipleChoiceField - that’s ultimately what I went with for
the project, but I couldn’t let go of
Hi,
On Dec/22/2020, Benny M wrote:
> That’s correct. I am using a class variable since there doesn’t seem
> to be a DRY - or at least not messy - way of manipulating this from
> __init__.
It's easy to make this mistake. I was bitten by something similar in a
class based view generating a
That’s correct. I am using a class variable since there doesn’t seem to be a
DRY - or at least not messy - way of manipulating this from __init__.
That said, your explanation makes sense and does answer the “why” of this. If
there’s a way of defining forms inside __init__ I haven’t found it…
Hi,
On Dec/22/2020, Benny M wrote:
> I’ve ran into some unexpected behavior while testing a ModelForm with
> a MultipleChoiceField and am trying to determine if this is a bug, or
> if maybe I’m doing something out of the ordinary.
I think that I might guess what it is. If I could see the
Hi all,
I’ve ran into some unexpected behavior while testing a ModelForm with a
MultipleChoiceField and am trying to determine if this is a bug, or if maybe
I’m doing something out of the ordinary.
In the form, I’m generating the MultipleChoiceField choices on the fly. e.g.
`OPTIONS =
5 matches
Mail list logo