Skip to content
Snippets Groups Projects
Select Git revision
  • e7a0b0e3c5b1c2617a79690fa3179daa0cfb9b20
  • master default protected
  • feat/new-image-formats
  • clickable-select-chevron
  • 2.20.0
  • 2.19.0
  • 2.18.0
  • 2.17.0
  • 2.16.1
  • 2.16.0
  • 2.15.0
  • 2.14.0
  • 2.13.0
  • 2.12.1
  • 2.11.0
  • 2.10.0
  • 2.9.1
  • 2.9.0
  • 2.8.0
  • 2.7.1
  • 2.7.0
  • 2.6.0
  • 2.5.2
  • 2.5.1
24 results

candidate-card.mustache

Blame
  • octopus_people_import.py 2.03 KiB
    from django.core.management.base import BaseCommand
    from wagtail.models.media import Collection
    
    from district.models import DistrictManualOctopusPersonPage, DistrictPeoplePage
    from district.tasks import (
        import_manual_person,
        import_people_from_group,
        import_people_from_team,
    )
    
    
    class Command(BaseCommand):
        help = """Importuje Osoby z Chobotnice."""
    
        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:
                        collection_id = Collection.objects.first().id
    
                    import_people_from_group.delay(
                        people_page.id,
                        collection_id,
                        group["shortcut"],
                        group["title"],
                    )
    
            for people_page in DistrictPeoplePage.objects.all():
                for team in people_page.get_syncable_octopus_teams():
                    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:
                        collection_id = Collection.objects.first().id
    
                    import_people_from_team.delay(
                        people_page.id,
                        collection_id,
                        team["shortcut"],
                        team["title"],
                        team["roles"],
                    )
    
            for person_page in DistrictManualOctopusPersonPage.objects.all():
                import_manual_person.delay(
                    person_page.id, person_page.root_page.image_collection_id
                )