summaryrefslogtreecommitdiff
path: root/ishtar_common/migrations/0042_auto_20180409_1901.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/migrations/0042_auto_20180409_1901.py')
-rw-r--r--ishtar_common/migrations/0042_auto_20180409_1901.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/ishtar_common/migrations/0042_auto_20180409_1901.py b/ishtar_common/migrations/0042_auto_20180409_1901.py
index a2faa24e4..0b377b9d8 100644
--- a/ishtar_common/migrations/0042_auto_20180409_1901.py
+++ b/ishtar_common/migrations/0042_auto_20180409_1901.py
@@ -29,10 +29,10 @@ def initialize_profiles(apps, schema_editor):
# match profile type with person types
for person in Person.objects.filter(ishtaruser__isnull=False):
- # is current if only one person_type is concerned
- current = person.person_types.count() == 1
- # only person with an account are concerned
- for person_type in person.person_types.all():
+ # order by txt_idx in order to put administrator first
+ for idx, person_type in enumerate(
+ person.person_types.order_by('txt_idx').all()):
+ current = not(idx) # first is current
UserProfile.objects.create(
profile_type=profile_types[person_type.txt_idx],
person=person,