(self)
| 259 | return new_objs |
| 260 | |
| 261 | def _get_default_pk_class(self): |
| 262 | pk_class_path = getattr( |
| 263 | self.app_config, |
| 264 | "default_auto_field", |
| 265 | settings.DEFAULT_AUTO_FIELD, |
| 266 | ) |
| 267 | if self.app_config and self.app_config._is_default_auto_field_overridden: |
| 268 | app_config_class = type(self.app_config) |
| 269 | source = ( |
| 270 | f"{app_config_class.__module__}." |
| 271 | f"{app_config_class.__qualname__}.default_auto_field" |
| 272 | ) |
| 273 | else: |
| 274 | source = "DEFAULT_AUTO_FIELD" |
| 275 | if not pk_class_path: |
| 276 | raise ImproperlyConfigured(f"{source} must not be empty.") |
| 277 | try: |
| 278 | pk_class = import_string(pk_class_path) |
| 279 | except ImportError as e: |
| 280 | msg = ( |
| 281 | f"{source} refers to the module '{pk_class_path}' that could " |
| 282 | f"not be imported." |
| 283 | ) |
| 284 | raise ImproperlyConfigured(msg) from e |
| 285 | if not issubclass(pk_class, AutoField): |
| 286 | raise ValueError( |
| 287 | f"Primary key '{pk_class_path}' referred by {source} must " |
| 288 | f"subclass AutoField." |
| 289 | ) |
| 290 | return pk_class |
| 291 | |
| 292 | def _prepare(self, model): |
| 293 | if self.order_with_respect_to: |
no test coverage detected