Skip to content

Get contact info of Armada people

Rasmus Rudling edited this page Nov 10, 2021 · 1 revision
from fair.models import Fair
from recruitment.models import RecruitmentApplication

fair = Fair.objects.filter(current=True).first()
applications = RecruitmentApplication.objects.filter(
    status="accepted", recruitment_period__fair=fair
)
out = "Name\tRole"


def takeFirst(elem):
    return elem[0]


def takeSecond(elem):
    return elem[1]


def takeThird(elem):
    return elem[2]


def takeForth(elem):
    return elem[3]


def takeFifth(elem):
    return elem[4]


contacts = []

for application in applications:
    member_role = application.delegated_role.name
    member_group = application.delegated_role.organization_group
    member_type = application.recruitment_period.name
    first_name = application.user.first_name
    last_name = application.user.last_name
    email = application.user.email
    contacts.append(
        [first_name, last_name, email, member_type, member_role, member_group]
    )

contacts_without_PM = contacts[1:]
contacts_without_PM.sort(key=takeFirst)

contacts_without_PM = [contacts[0]] + contacts_without_PM
for contact in contacts_without_PM:
    print(f"{contact[0]},{contact[1]},{contact[2]}")
Clone this wiki locally