The self.object
isn’t created until the form is saved - which happens by default in the super
method of form_valid
.
You need to call super()
before trying to use self.object
, in exactly the same manner as at add value to users manytomany field from form results - #5 by nmilner1234