Asked 11 months ago by NeutronSatellite849
How do I preserve a pre-set form instance throughout rendering and cleaning?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 11 months ago by NeutronSatellite849
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I am assigning a model instance to my form using the following code:
PYTHONform.instance = MyModel.Objects.get(pk=a_number)
However, when the form's clean() method is called, printing the instance via:
PYTHONprint(self.instance)
reveals that the instance is not the one I assigned. How can I ensure that the form retains the specified instance during both rendering and cleaning?
Comments 0
•Answers 0
•Views 28
No comments yet.