Base classes
Signup Flow
When writing a custom signup flow, subclass from AbstractSignupFlow
and register your class
with the corresponding signal. There’s also BaseSignupFlow
that provides some basic implementations
for common patterns and is used by many of the builtin flows.
- class ephios.core.signup.flow.abstract.AbstractSignupFlow(shift, event=None)
Abstract base class for signup flow.
A signup flow defines the logic for how a participant signs up for a shift. It checks if the participant is eligible to sign up, and if so, creates a participation object. It is not responsible for what the participant does inside the shift, only for the process of signing up. It provides forms for disposition and configuration.
- _abc_impl = <_abc._abc_data object>
- decline_error_message = 'Declining failed: {error}'
- decline_success_message = 'You have successfully declined {shift}.'
- property description
A human-readable description of this signup flow.
- get_configuration_form(*args, **kwargs)
Return a form to configure this signup flow.
- get_or_create_participation_for(participant) AbstractParticipation
- get_signup_info()
Return key/value pairs about the configuration to show in exports etc.
- perform_decline(participant, participation=None, **kwargs)
Perform the decline for the given participant.
- perform_signup(participant: AbstractParticipant, participation=None, acting_user=None, **kwargs) AbstractParticipation
Perform the signup for the given participant. kwargs are passed from the signup view and can be used to customize the signup. Usually it’s the cleaned_data from the signup form.
- registration_button_text = 'Sign up'
- signup_error_message = 'Signing up failed: {error}'
- signup_success_message = 'You have successfully signed up for {shift}.'
- property slug
A unique identifier for this signup flow.
- property uses_requested_state
Whether this signup flow uses the requested state.
- property verbose_name
The human-readable name of this signup flow.
Shift structure
When writing a custom signup flow, subclass from AbstractShiftStructure
and register your class
with the corresponding signal. There’s also BaseShiftStructure
that provides some basic implementations
for common patterns and is used by many of the builtin flows.
- class ephios.core.signup.structure.abstract.AbstractShiftStructure(shift, event=None)
Abstract base class for shift structure.
A shift structure defines what a participant does inside the shift. There may be no structure at all or some elaborate staff hierarchy.
The structure is responsible for rendering the participations of the shift.
- _abc_impl = <_abc._abc_data object>
- property description
A human-readable description of this structure.
- property disposition_participation_form_class
This form will be used for participations in disposition. Set to None if you don’t want to support the default disposition.
- get_checkers()
Return a list of checkers that should be run when validating signup actions.
- get_configuration_form(*args, **kwargs)
This form will be used to configure this structure. The cleaned data will be saved to shift.structure_configuration
- get_list_export_data()
Returns a list of list of dictionaries corresponding to participations or positions in this shift. This should include all participations regardless of state or type as well as unfilled positions. The dictionary must contain the following items:
- “participation”
contains a participation object can be None only if you provide an unfilled position
- “required_qualifications”
contains a collection of Qualification items required for a position can be empty for unmatched participations
- “description”:
contains a string describing the position should be empty for unmatched participations
- get_participant_count_bounds()
Return a tuple of min, max for how many participants are allowed for the shift. Use None for any value if it is not specifiable.
- get_signup_info()
Return key/value pairs about the configuration to show in exports etc.
- get_signup_stats() SignupStats
Return an instance of SignupStats for the shift.
- has_customized_signup(participation)
Return whether the participation was customized in a way specific to this shift structure.
- render(context)
Render the state/participations of the shift. Match the signature of template.render for use with the include template tag: {% include shift.structure %} By default, this loads shift_state_template_name and renders it using context from get_shift_state_context_data.
- property signup_form_class
This form will be used for participations in signup.
- property slug
A unique identifier for this structure.
- property verbose_name
The human-readable name of this structure.
Consequences
Implement custom conseqence types by subclassing from BaseConsequenceHandler
and registering
it with the corresponding signal.
- class ephios.core.consequences.BaseConsequenceHandler
- classmethod execute(consequence)
Gets a consequence and tries to execute whatever it is the consequence wants to happen.
- classmethod filter_queryset(qs, user: UserProfile)
Return a filtered that excludes consequences with the slug of this class that the user is not allowed to edit. Consequences should also be annotated with values needed for rendering.
- classmethod render(consequence)
Return html describing the action to be done as a consequence of what. Return None if you cannot handle this consequence.
- property slug
Notifications
Implement custom notification types or backends by subclassing from the following classes and registering them with the corresponding signal.
- class ephios.core.services.notifications.types.AbstractNotificationHandler
- classmethod as_html(notification)
- classmethod as_plaintext(notification)
- email_template_name = 'core/mails/notification.html'
- classmethod get_actions(notification)
Return a list of (label, url) tuples that make this notification actionable. The first url will be used as the primary action in push notifications.
- classmethod get_actions_with_referrer(notification)
Annotate the actions returned by any subclass with a reference to the originating notification. This is used by EphiosNotificationMiddleware to mark the corresponding notification as read once the user clicks on the link.
- classmethod get_body(notification)
- classmethod get_render_context(notification)
- classmethod get_subject(notification)
- classmethod is_obsolete(notification)
- plaintext_template_name = 'core/mails/notification.txt'
- property slug
- property title
- unsubscribe_allowed = True
- class ephios.core.services.notifications.backends.AbstractNotificationBackend
- classmethod send(notification: Notification)
- classmethod send_multiple(notifications: Iterable[Notification])
- classmethod sending_possible(notification)
- classmethod should_send(notification)
- property slug
- property title
- classmethod user_prefers_sending(notification)