code: def save_m2m(self, obj, data, using_transactions, dry_run):
          
          if not using_transactions and dry_run:
              # we don't have transactions and we want to do a dry_run
              pass
          else:
              for field in self.get_import_fields():
                  if not isinstance(field.widget, widgets.ManyToManyWidget):
                      continue
                  self.import_field(field, obj, data, True)
docs: Saves m2m fields.
  
          Model instance need to have a primary key value before
          a many-to-many relationship can be used.