Signals
Django includes a signal dispatcher that allows adding reactions on certain actions easily. Besides djangos built-in signals juntagrico sends the signals below.
Job signals
job_canceled
Trigger: Job is saved with the canceled flag set (and the flag wasn’t set before).
Arguments:
instance: The job instance that was canceled
Default receivers:
handle_job_canceled: Sends notification email to members that were signed up to that job and remove them from the job.
job_time_changed
Trigger: Existing job is saved with a changed time field
Arguments:
instance: The job instance whose time was changed
Default receivers:
handle_job_time_changed: Sends notification email to members that are signed up to that job.
subscribed
Sender: Job
Trigger: Member subscribes to a job or unsubscribed from it.
Arguments:
instance: The job instance that the member subscribed to
member: Member that subscribed to the job
count: The number of assignments. Is 0 if the member unsubscribes completely
initial_count: The previous number of assignments. Is 0 if member was not signed up before
message: A message from the member
Default receivers:
on_job_subscribed: Sends confirmation to member and notification to admin.
Subscription signals
sub_created
Trigger: A new subscription has been saved.
Arguments:
instance: The subscription instance that was created
Default receivers:
handle_sub_created: No action.
sub_activated
Trigger: A subscription, where deactivation date and activation date was not set already, is being saved with an activation date.
Arguments:
instance: The subscription instance that was changed
Default receivers:
handle_sub_activated: Checks that none of the members has overlapping subscriptions when this one is activated, and raises an exception otherwise. Sets the activation date of the parts and the join date of the members according to the new activation date.
sub_deactivated
Trigger: A subscription, where deactivation date was not set already, is being saved with a deactivation date.
Arguments:
instance: The subscription instance that was changed
Default receivers:
handle_sub_deactivated: Sets leave date of all members of subscription to the deactivation date. Sets the deactivation date of active parts and deletes parts that have not been active yet.
sub_canceled
Trigger: A subscription, where cancellation date was not set already, is being saved with a cancellation date.
Arguments:
instance: The subscription instance that was changed
Default receivers:
handle_sub_canceled: Sets cancellation date of all active parts of subscription and deletes the not yet active parts.
depot_changed
Trigger: A member requests to change their depot
Arguments:
subscription: The subscription instance on which the depot should be changed
member: Member that requested the depot change
old_depot: Original depot of the subscription
new_depot: Newly requested depot of the subscription
immediate: True, if the change was performed automatically. This is done, when the subscription is not yet activated.
Default receivers:
on_depot_changed: Notify users with permission notified_on_depot_change via email.
depot_change_confirmed
Triggers:
Depot lists are generated using the management command generate_depot_list without the –no-future flag
Admin confirms the depot change in the management list.
Arguments:
instance: The subscription instance on which the depot change was confirmed
Default receivers:
on_depot_change_confirmed: Notify Member and co-members of the subscription about the change.
Extra subscription signals
extra_sub_activated
Trigger: None
extra_sub_deactivated
Trigger: None
Subscription part signals
sub_part_activated
Trigger: A subscription part, where deactivation and activation date were not set already, is being saved with an activation date.
Arguments:
instance: The subscription part instance that was changed
Default receivers: None
sub_part_deactivated
Trigger: A subscription part, where deactivation was not set already, is being saved with a deactivation date.
Arguments:
instance: The subscription part instance that was changed
Default receivers: None
Member signals
member_created
Trigger: A new member has been saved.
Arguments:
instance: The member instance that was created
Default receivers:
handle_member_created: Notify users with permission notified_on_member_creation via email.
member_canceled
Warning
Deprecated since version 1.7.0. Use canceled with sender Member instead.
Trigger: A member that had no cancellation date set, is saved with a cancellation date.
Arguments:
instance: The member instance that was changed
Default receivers: None
canceled
Sender: Member
Trigger: Member cancels their membership
Arguments:
instance: The member instance of the member that canceled
message (optional): The message the member left on cancellation
Default receivers:
on_member_canceled: Notify users with permission notified_on_member_cancellation via email.
member_deactivated
Trigger: A member that had no deactivation date set, is saved with a deactivation date.
Arguments:
instance: The member instance that was changed
Default receivers:
handle_member_deactivated: Remove the member from all activity areas.
assignment_changed
Trigger: A user with permission changed the job assignments of a member on the job page.
Arguments:
instance: The member instance whose assignment was changed
job: job of the changed assignments
editor: User who changed the assignment
count: New number of assignments of member on this job
initial_count: Original number of assignments of member on this job
message: Message entered by the editor.
Default receivers:
on_assignment_changed: Inform member and job contact about the changed assignments
Management Command signals
called
Sender: generate_depot_list.Command
Trigger: Management command is called
Arguments: None
Default receivers:
on_depot_list_generated: Inform admin when Depot list is generated.