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.

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.

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

user: Mapped[User][source]

The website user object for this volunteer

Roles

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

A role which a volunteer can perform.

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

Admins for this role

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.

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

Volunteers who are interested in this role

name: Mapped[str][source]

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

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

role_notes: Mapped[str | None][source]

Things to know for the shift

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

Shifts

team: Mapped[Team][source]

The team this role is under

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

Volunteers who are trained for this role

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

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

role: Mapped[Role][source]

Role the user is an admin for

volunteer: Mapped[Volunteer][source]

Volunteer to be an admin

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.

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

Entries (volunteers) for this shift

classmethod generate_for(role, venue, first, final, min, max, base_duration=120, changeover=15)[source]

Build Shift records between start and end times.

Return type:

list[Shift]

Args:

first: an ISO8601 datetime indicating the start of the first shift

final: an ISO8601 datetime indicating the end of the last shift

min: is the minimum number of people needed to staff these shifts and still get the job done.

max: is the maximum number of people who can practically staff these shifts and having something to do.

base_duration: is how long we want a shift to be. The last shift of the day may be slightly shorter.

changeover: indicates the time in minutes to overlap two shifts, allowing some time for volunteers to handover between each other. Shifts will start changeover minutes before the configured start time.

classmethod get_all_for_day(day)[source]

Return all shifts for the requested day.

Return type:

Sequence[Self]

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.

max_needed: Mapped[int][source]

Maximum number of volunteers required for the shift

min_needed: Mapped[int][source]

Minimum number of volunteers required for the shift

occurrence: Mapped[Occurrence][source]

Optional Occurrence (talk/workshop) related to this shift

role: Mapped[Role][source]

Role that this shift is filling

venue: Mapped[VolunteerVenue][source]

Venue where the shift occurs

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.

Venues

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

A location for a volunteering shift.