This can probably be solved in a single SQL query using `bulk_create` on the intermediate table: https://docs.djangoproject.com/en/dev/ref/models/querysets/#bulk-create

See https://github.com/tnc-ba/strongTNC/blob/master/apps/swid/utils.py#L83-L86 for an example.