In a ModelForm, self.instance is derived from the model
attribute specified in the Meta class. Your self
in this context is obviously an instance of your subclass of ModelForm, and self.instance is (and will be on saving the form without errors) an instance of the model class you specified, although you have not done so in your example.
Accessing self.instance in __init__
may not work, though doing so after calling the parent's __init__
probably will. Further, I wouldn't recommend trying to change the instance directly. If you are interested, have a look at the BaseModelForm code on Github. The instance
can also be specified when creating a new form via the instance
argument.