1👍
✅
Object must be saved – so that it has primary key – before M2M relationships are saved. Update your code as
connector = Connector(profile=profile)
connector.profile = profile
connector.save()
connector.attributes = self.cleaned_data['selected_attributes']
connector.save()
Source:stackexchange.com