wagtail-nest/wagtail-airtable

PK Value coming across as none on newly created db objects

bmoe872 opened this issue · 1 comments

if you have the AIRTABLE_UNIQUE_IDENTIFIER set as something like {'wagtail_id': 'pk'} then the pk should, in theory, be exported through the export_mapping.

However, due to the order of operations, if it's a brand new model in the DB the pk isn't assigned until after the model has already been sent off to Airtable, meaning Airtable doesn't get the PK value until you save again.

I think all we need to do, to get around this is call super().save() before going into the airtable logic.

Hey @bmoe872

Thanks for filing this issue and opening a PR against it! I'm going to close this ticket.

Cheers!