Volunteering system

The volunteering system allows us to manage volunteers at EMF. You can find more detail on these models are used in the volunteering app docs.

Volunteer

class models.volunteer.volunteer.Volunteer(**kwargs)[source]

A volunteer, which is mapped 1:1 to a website User.

user: Mapped[User][source]

The website user object for this volunteer

interested_roles: Mapped[list[Role]][source]

Roles a volunteer is interested in performing

trained_roles: Mapped[list[Role]][source]

Roles a volunteer has been trained to perform

property administered_role_ids: set[int][source]

Role IDs this user can administer, combining direct role admin and team admin.

property administered_team_ids: set[int][source]

Team IDs this user can administer.

property permitted_shift_times: tuple[datetime, datetime][source]

Returns the earliest and latest time at which this volunteer can take a shift.

Roles

class models.volunteer.role.Role(**kwargs)[source]

A role which a volunteer can perform.

slug: Mapped[str][source]

A short, stable, urlsafe, identifier used for de-duplication during data seeding.

name: Mapped[str][source]

The name used to present a role. Should be kept short as it gets used in lists.

description: Mapped[str | None][source]

A brief summary of the role

full_description_md: Mapped[str | None][source]

A longer description of the role, supports Markdown.

instructions_url: Mapped[str | None][source]

A link to some instructions on how to perform the role.

role_notes: Mapped[str | None][source]

Things to know for the shift

over_18_only: Mapped[bool][source]

Whether the role is restricted to over-18s (e.g. bar shifts)

requires_training: Mapped[bool][source]

Whether the role requires training to perform

team: Mapped[Team][source]

The team this role is under

admins: Mapped[list[RoleAdmin]][source]

Admins for this role

shifts: Mapped[list[Shift]][source]

Shifts

shift_templates: Mapped[list[ShiftTemplate]][source]

Shift templates used to generate the full shift schedule for this role

shifts_finalised: Mapped[bool][source]

Whether shift timings have been finalised. Once finalised no further changes can be made via shift templates as the role will be made available to attendees for shift signup.

interested_volunteers: Mapped[list[Volunteer]][source]

Volunteers who are interested in this role

trained_volunteers: Mapped[list[Volunteer]][source]

Volunteers who are trained for this role

classmethod grouped_by_team(only=None)[source]

Return a list of roles, and their shift counts, grouped by the team they sit under.

If only is passed then only roles within the pass list of IDs will be returned, this is primarily intended to scope this to the list of roles a user has admin privileges for.

Return type:

dict[Team, list[tuple[Role, int]]]

class models.volunteer.role.RoleAdmin(**kwargs)[source]

Join table used to indicate a given volunteer has admin permissions for a role.

volunteer: Mapped[Volunteer][source]

Volunteer to be an admin

role: Mapped[Role][source]

Role the user is an admin for

class models.volunteer.role.RolePermission(**kwargs)[source]

Shifts

class models.volunteer.shift.Shift(**kwargs)[source]

An available shift for one or more volunteers to perform.

min_needed: Mapped[int][source]

Minimum number of volunteers required for the shift

max_needed: Mapped[int][source]

Maximum number of volunteers required for the shift

role: Mapped[Role][source]

Role that this shift is filling

venue: Mapped[VolunteerVenue][source]

Venue where the shift occurs

occurrence: Mapped[Occurrence][source]

Optional Occurrence (talk/workshop) related to this shift

entries: Mapped[list[ShiftEntry]][source]

Entries (volunteers) for this shift

generated_from: Mapped[ShiftTemplate | None][source]

The ShiftTemplate that resulted in this shift

is_clash(other)[source]

Calculate whether this shift clashes with another.

We use this to determine if we should allow a volunteer to sign up for both shifts, which is only permitted if the other shift is filling the same role in the same venue. In all other cases a volunteer can’t sign up for two shifts at the same time.

This is needed because contiguous shifts often have a slight overlap.

property local_start[source]

Shift start time in the event timezone.

property local_end[source]

Shift end time in the event timezone.

classmethod get_all_for_day(day, *, include_unfinalised=False)[source]

Return all shifts for the requested day.

For the purposes of shifts we consider a day to run from 04:00-03:59 so that late night shifts get shown in the context of the day leading up to them.

If include_unfinalised is True than all shifts will be returned, otherwise only those from finalised roles will be returned.

Return type:

Sequence[Self]

classmethod earliest_and_latest_in_range(start, end)[source]

Return the earliest and latest shift available to a volunteer.

Return type:

tuple[datetime | None, datetime | None]

class models.volunteer.shift.ShiftEntry(**kwargs)[source]

Join table used to indicate a volunteer has signed up for a given shift.

state: Mapped[ShiftEntryState][source]

Indicates whether a volunteer has arrived for/completed a shift.

eligible_for_checkin_at(now)[source]

Checks if we can transition to ARRIVED and the shift starts in 15 minutes or less from now.

Return type:

bool

eligible_for_checkout_at(now)[source]

Checks if we can transition to a checked out state.

Return type:

bool

eligible_for_completion_at(now)[source]

Checks if we can transition to COMPLETED and a sufficient portion of the shift has passed.

Return type:

bool

Venues

class models.volunteer.venue.VolunteerVenue(**kwargs)[source]

A location for a volunteering shift.