akvo.rsr.management.commands.migrate_related_project_hierarchies module
- class akvo.rsr.management.commands.migrate_related_project_hierarchies.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]
Bases:
BaseCommand
- add_arguments(parser: ArgumentParser)[source]
Entry point for subclassed commands to add custom arguments.
- handle(*args, **options)[source]
The actual logic of the command. Subclasses must implement this method.
- help = 'Create a tree structure of Projects from RelatedProjects'
- class akvo.rsr.management.commands.migrate_related_project_hierarchies.Migrator(stdout: TextIO, stderr: TextIO, apply: bool)[source]
Bases:
object
- aggregate_sibling_parents(sibling_groups: List[Set[Project]]) → Dict[Project, Set[Project]][source]
Aggregates sibling groups that one parent in a dict
- get_group_parents(sibling_group: Set[Project]) → Dict[UUID, Set[Project]][source]
The parents of the sibling group
- group_siblings(related_projects: List[RelatedProject]) → List[Set[UUID]][source]
Make groups of sibling projects as sets of project IDs
- migrate_siblings()[source]
Migrate RelatedProjects with sibling relation
Siblings have to be migrated once the parent+child RelatedProjects have been treated. :return:
- resolve_sibling_groups(related_siblings: List[RelatedProject], sibling_uuid_groups: List[Set[UUID]]) → List[Set[Project]][source]
Use cache to resolve project UUIDs in the groups to projects