1👍
✅
Only fields named in the fields
tuple are saved to the instance. You don’t have your m2m field listed there.
You also define your modelchoicefield with a different name – class_persons instead of persons. In fact, there is no reason to define that field separately at all – you haven’t changed any of the attributes from the defaults.
And once you’ve removed that definition, there is also no reason to override __init__
, seeing as you never pass the user parameter nor do you use it anywhere in the form.
Source:stackexchange.com