diff --git a/ebpub/ebpub/db/migrations/0026_make_unique_lookup_names.py b/ebpub/ebpub/db/migrations/0026_make_unique_lookup_names.py index 6d70f60f..3413b2f0 100644 --- a/ebpub/ebpub/db/migrations/0026_make_unique_lookup_names.py +++ b/ebpub/ebpub/db/migrations/0026_make_unique_lookup_names.py @@ -9,7 +9,7 @@ class Migration(DataMigration): def forwards(self, orm): "Write your forwards methods here." # Ensure names are unique. - for lname in orm['db.lookup'].objects.all().distinct('name').values_list('name'): + for lname in orm['db.lookup'].objects.all().distinct('name').order_by('name').values_list('name'): lname = lname[0] for sf in orm['db.schemafield'].objects.all(): with_name = orm['db.lookup'].objects.filter(name=lname, schema_field=sf)