Ticket #26693: makemigrations.diff

File makemigrations.diff, 950 bytes (added by vinay karanam, 8 years ago)
  • django/db/migrations/operations/models.py

    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):  
    275275        )
    276276
    277277    def state_forwards(self, app_label, state):
     278        cached = 'apps' in state.__dict__
    278279        apps = state.apps
    279280        model = apps.get_model(app_label, self.old_name)
    280281        model._meta.apps = apps
    class RenameModel(ModelOperation):  
    332333                state.models[related_key].fields = new_fields
    333334                state.reload_model(*related_key)
    334335        state.reload_model(app_label, self.new_name_lower)
     336        if not cached:
     337            del state.__dict__['apps']
    335338
    336339    def database_forwards(self, app_label, schema_editor, from_state, to_state):
    337340        new_model = to_state.apps.get_model(app_label, self.new_name)
Back to Top