diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index 4c9467c..bb1d037 100644
a
|
b
|
class RenameModel(ModelOperation):
|
275 | 275 | ) |
276 | 276 | |
277 | 277 | def state_forwards(self, app_label, state): |
| 278 | cached = 'apps' in state.__dict__ |
278 | 279 | apps = state.apps |
279 | 280 | model = apps.get_model(app_label, self.old_name) |
280 | 281 | model._meta.apps = apps |
… |
… |
class RenameModel(ModelOperation):
|
332 | 333 | state.models[related_key].fields = new_fields |
333 | 334 | state.reload_model(*related_key) |
334 | 335 | state.reload_model(app_label, self.new_name_lower) |
| 336 | if not cached: |
| 337 | del state.__dict__['apps'] |
335 | 338 | |
336 | 339 | def database_forwards(self, app_label, schema_editor, from_state, to_state): |
337 | 340 | new_model = to_state.apps.get_model(app_label, self.new_name) |