def execute(self, using, inserted_entities):
def format_field(format, inserted_entities):<EOL><INDENT>if callable(format):<EOL><INDENT>return format(inserted_entities)<EOL><DEDENT>return format<EOL><DEDENT>def turn_off_auto_add(model):<EOL><INDENT>for field in model._meta.fields:<EOL><INDENT>if getattr(field, '<STR_LIT>', False):<EOL><INDENT>field.auto_now = False<EOL><DEDENT>if getattr(field, '<STR_LIT>', False):<EOL><INDENT>field.auto_now_add = False<EOL><DEDENT><DEDENT><DEDENT>manager = self.model.objects.db_manager(using=using)<EOL>turn_off_auto_add(manager.model)<EOL>faker_data = {<EOL>field: format_field(field_format, inserted_entities)<EOL>for field, field_format in self.field_formatters.items()<EOL>}<EOL>for data_field in faker_data:<EOL><INDENT>field = self.model._meta.get_field(data_field)<EOL>if field.max_length and isinstance(faker_data[data_field], str):<EOL><INDENT>faker_data[data_field] = faker_data[data_field][:field.max_length]<EOL><DEDENT><DEDENT>obj = manager.create(**faker_data)<EOL>return obj.pk<EOL>
Execute the stages entities to insert
:param using:
:param inserted_entities: