From 89ec6995ccd8cbd8811d7a3ef4f5de0d3c548fd5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexa=20Valentov=C3=A1?= <git@imaniti.org>
Date: Mon, 4 Nov 2024 14:09:40 +0100
Subject: [PATCH] fix order, collection id

---
 district/management/commands/octopus_people_import.py | 4 ++++
 shared/people_import.py                               | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/district/management/commands/octopus_people_import.py b/district/management/commands/octopus_people_import.py
index 13bd1319..100857dd 100644
--- a/district/management/commands/octopus_people_import.py
+++ b/district/management/commands/octopus_people_import.py
@@ -15,6 +15,10 @@ class Command(BaseCommand):
     def handle(self, *args, **options):
         for people_page in DistrictPeoplePage.objects.all():
             for group in people_page.get_syncable_octopus_groups():
+                if not hasattr(people_page.root_page, "image_collection_id"):
+                    # FIXME: This should not be UniwebHomePage, but sometimes it is.
+                    continue
+
                 collection_id = people_page.root_page.image_collection_id
 
                 if collection_id is None:
diff --git a/shared/people_import.py b/shared/people_import.py
index 03c00697..35bb1ab5 100644
--- a/shared/people_import.py
+++ b/shared/people_import.py
@@ -39,7 +39,7 @@ class ImporterMixin:
             "email": profile["email"],
             "phone": profile["phone"],
             "position": profile.get("position"),
-            "order": profile.get("order"),
+            "order": profile.get("order", 0),
             "facebook_url": profile["facebookUrl"],
             "flickr_url": profile["flickrUrl"],
             "instagram_url": profile["instagramUrl"],
-- 
GitLab