diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index 027ebfe..2b449c2 100644
a
|
b
|
class RenameModel(ModelOperation):
|
278 | 278 | ) |
279 | 279 | |
280 | 280 | def state_forwards(self, app_label, state): |
| 281 | reset_apps = 'apps' not in state.__dict__ |
281 | 282 | apps = state.apps |
282 | 283 | model = apps.get_model(app_label, self.old_name) |
283 | 284 | model._meta.apps = apps |
… |
… |
class RenameModel(ModelOperation):
|
335 | 336 | state.models[related_key].fields = new_fields |
336 | 337 | state.reload_model(*related_key) |
337 | 338 | state.reload_model(app_label, self.new_name_lower) |
| 339 | if reset_apps: |
| 340 | del state.__dict__['apps'] |
338 | 341 | |
339 | 342 | def database_forwards(self, app_label, schema_editor, from_state, to_state): |
340 | 343 | new_model = to_state.apps.get_model(app_label, self.new_name) |