(locations, include_archive_ancestors)
Perform filtering on a location queryset.

    include_archive_ancestors toggles between selecting only active
    children and selecting any child that is archived or has
    archived descendants.
Perform filtering on a location queryset.
Perform filtering on a location queryset .
def filter_for_archived(locations, include_archive_ancestors):
    """
    Perform filtering on a location queryset.

    include_archive_ancestors toggles between selecting only active
    children and selecting any child that is archived or has
    archived descendants.
    """
    if include_archive_ancestors:
        return [
            item for item in locations
            if item.is_archived or item.archived_descendants()
        ]
    else:
        return locations.filter(is_archived=False)
def filter_for_archived ( locations , include_archive_ancestors ) : if include_archive_ancestors : return [ item for item in locations if item . is_archived or item . archived_descendants ( ) ] else : return locations . filter ( is_archived = False )