Appointment
One of the available form types in Open Forms is the appointment form type. These forms have a fixed flow through the form and require an integration with an appointment service provider.
The appointments module provides the available product lookups and creation or cancellation of appointments.
Python API
Module interface
The module-level API serves as an abstraction over the various plugins.
Public API of the appointments module.
The exported names here may be used in other django apps and/or Open Forms modules. Anything else is considered private API.
- class openforms.appointments.service.AppointmentRenderer(submission: Submission, mode: RenderModes, as_html: bool)
Custom renderer outputting the appointment contact details.
- get_children() Iterator[ComponentNode]
Produce only the direct child nodes.
- openforms.appointments.service.get_email_confirmation_recipients(submission: Submission) list[str]
Extract confirmation email recipient addresses, if relevant.
If the submission is for a form that is not a (new-style) appointment form, an empty list is returned. The caller is expected to apply different logic to obtain the e-mail addresses.
- openforms.appointments.service.get_plugin(plugin: str = '') BasePlugin
returns plugin selected in AppointmentsConfig
Plugin interface
- class openforms.appointments.base.BasePlugin(identifier: str)
Base Appointment plugin.
- configuration_options
alias of
EmptyOptions
- abstractmethod create_appointment(products: list[Product], location: Location, start_at: datetime, client: CustomerDetails, remarks: str = '') str
Create an appointment.
- Parameters:
products – List of
Product, as obtained fromget_available_products().location – An
Location, as obtained fromget_locations().start_at – A datetime to start the appointment, as obtained from
get_dates().client – A
CustomerDetailsthat holds client details.remarks – A
strfor additional remarks, added to the appointment.
- Returns:
An appointment identifier as
str.- Raises:
AppointmentCreateFailed – If the appointment could not be created.
- abstractmethod delete_appointment(identifier: str) None
Delete an appointment.
- Parameters:
identifier – A string that represents the unique identification of the appointment.
- Raises:
AppointmentDeleteFailed – If the appointment could not be deleted.
- abstractmethod get_appointment_details(identifier: str) AppointmentDetails
Get appointment details.
- Parameters:
identifier – A string that represents the unique identification of the appointment.
- Returns:
AppointmentDetails.
- abstractmethod get_available_products(current_products: list[Product] | None = None, location_id: str = '') list[Product]
Retrieve all available products and services to create an appointment for.
You can pass
current_productsto only retrieve available products in combination with thecurrent_products.- Parameters:
current_products – List of
Product, as obtained from anotherget_available_products()call.location_id – ID of the location to filter products on - plugins may support this.
- Returns:
List of
Product
- abstractmethod get_dates(products: list[Product], location: Location, start_at: date | None = None, end_at: date | None = None) list[date]
Retrieve all available dates for given
productsandlocation.- Parameters:
products – List of
Product, as obtained fromget_available_products().location – An
Location, as obtained fromget_locations().start_at – The start
dateto retrieve available dates for. Default:date.today().end_at – The end
dateto retrieve available dates for. Default: 14 days afterstart_date.
- Returns:
List of
date
- abstractmethod get_locations(products: list[Product] | None = None) list[Location]
Retrieve all available locations.
- Parameters:
products – List of
Product, as obtained fromget_available_products(). IfNoneor unspecified, all possible locations are returned. Otherwise, if the plugin supports it, locations are filtered given the products.- Returns:
List of
Location
- abstractmethod get_required_customer_fields(products: list[Product]) RequiredCustomerFields
Given a list of products, return the additional required customer fields and their specific rules for a group of fields (if exists).
The fields are returned as a Form.io components array, including possible useful autocomplete attributes. This should make it easy to render the fields using existing tooling.
- abstractmethod get_times(products: list[Product], location: Location, day: date) list[datetime]
Retrieve all available times for given
products,locationandday.- Parameters:
products – List of
Product, as obtained from get_available_products.location – An
Location, as obtained from get_locations.day – A
dateto retrieve available times for.
- Returns:
List of available
datetime.