Take an Apps and return a ProjectState matching it.
(cls, apps)
| 593 | |
| 594 | @classmethod |
| 595 | def from_apps(cls, apps): |
| 596 | """Take an Apps and return a ProjectState matching it.""" |
| 597 | app_models = {} |
| 598 | for model in apps.get_models(include_swapped=True): |
| 599 | model_state = ModelState.from_model(model) |
| 600 | app_models[(model_state.app_label, model_state.name_lower)] = model_state |
| 601 | return cls(app_models) |
| 602 | |
| 603 | def __eq__(self, other): |
| 604 | return self.models == other.models and self.real_apps == other.real_apps |