Used to unpickle Model subclasses with deferred fields.
(model_id)
| 2554 | |
| 2555 | |
| 2556 | def model_unpickle(model_id): |
| 2557 | """Used to unpickle Model subclasses with deferred fields.""" |
| 2558 | if isinstance(model_id, tuple): |
| 2559 | model = apps.get_model(*model_id) |
| 2560 | else: |
| 2561 | # Backwards compat - the model was cached directly in earlier versions. |
| 2562 | model = model_id |
| 2563 | return model.__new__(model) |
| 2564 | |
| 2565 | |
| 2566 | model_unpickle.__safe_for_unpickle__ = True |