0

I am using Django 1.11 and I'm trying to add data to a ModelForm using CreateView after POST submit. The form first submits data to a linked MS exchange account using the exchangelib library. I then return the exchange id created and this is what Im trying to add to the ModelForm so that it is captured in my Model database. Everything is working fine up to the point I return the exchange id. My issue is I am unsure how to add this into the form for capturing.

Does anyone have any advice on how to add this returned datapoint to the form? I am using def post if form.is_valid() and have tried setting self.initial unsuccessfully.

Any help would be greatly appreciated!

cr1
  • 199
  • 2
  • 16

1 Answers1

0

Ok so I was going about this the wrong way. Ended up getting it to work by using def form_valid(self, form) with form.instance.exchange_id = ex.uid

cr1
  • 199
  • 2
  • 16