Ticket #26149: migration-bug.patch

File migration-bug.patch, 1.7 KB (added by anabelensc, 8 years ago)
  • django/db/migrations/autodetector.py

    diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
    index f28c89c..a939d42 100644
    a b class MigrationAutodetector(object):  
    577577                for name, field in sorted(related_fields.items())
    578578            ]
    579579            related_dependencies.append((app_label, model_name, None, True))
     580            if order_with_respect_to:
     581                self.add_operation(
     582                    app_label,
     583                    operations.AlterOrderWithRespectTo(
     584                        name=model_name,
     585                        order_with_respect_to=order_with_respect_to,
     586                    ),
     587                    dependencies=[
     588                        (app_label, model_name, order_with_respect_to, True),
     589                        (app_label, model_name, None, True),
     590                    ]
     591                )
    580592            if unique_together:
    581593                self.add_operation(
    582594                    app_label,
    class MigrationAutodetector(object):  
    595607                    ),
    596608                    dependencies=related_dependencies
    597609                )
    598             if order_with_respect_to:
    599                 self.add_operation(
    600                     app_label,
    601                     operations.AlterOrderWithRespectTo(
    602                         name=model_name,
    603                         order_with_respect_to=order_with_respect_to,
    604                     ),
    605                     dependencies=[
    606                         (app_label, model_name, order_with_respect_to, True),
    607                         (app_label, model_name, None, True),
    608                     ]
    609                 )
    610610
    611611    def generate_created_proxies(self):
    612612        """
Back to Top