feriennet.models.group_invite

Classes

GroupInvite

Module Contents

class feriennet.models.group_invite.GroupInvite(session: sqlalchemy.orm.Session, group_code: str, username: str | None)[source]
session[source]
group_code[source]
username[source]
classmethod create(session: sqlalchemy.orm.Session, username: str | None) Self[source]

Creates a new group invite with a code that is not yet used.

for_username(username: str | None) Self[source]
property user: onegov.user.User | None[source]
property exists: bool[source]

Returns True if the group_code associated with this invite exists.

bookings() Query[Booking][source]

Returns a query of the bookings associated with this invite.

property occasion: onegov.activity.models.Occasion[source]

Looks up the occasion linked to this group invite.

Technically it would be possible that a group code points to multiple occasions, but that would be an error. If that happens, an exception will be thrown.

property attendees: tuple[tuple[onegov.activity.models.Attendee, onegov.activity.models.Booking], Ellipsis][source]

Returns the attendees linked to this invite.

prospects(username: str) Iterator[tuple[Attendee, Booking | None]][source]

Returns the attendees associated with the given users that are not yet part of the group.

The result is a list of tuples with the first element being the attendee and the second element being the booking for the linked occasion, if such a booking already exists (otherwise None).