Example #1
0
 def event_activated(registration):
     """
     Event has been activated
     """
     employee = get_employee(registration.casy_ref)
     if employee and employee["email"]:
         salut = " ".join([
             employee["salutation_short"], employee["firstname"],
             employee["lastname"]
         ])
         send("test", (employee["email"], ),
              {"msg": "%s\nThis event will be performed" % salut})
Example #2
0
def registration_delete(sender, instance, using, **kwargs):  # pylint: disable=W0613
    """
    Send e-mail notification about registration deletion to previously
    registered person
    """
    employee = get_employee(instance.casy_ref)
    if employee and employee["email"]:
        salut = " ".join([
            employee["salutation_short"], employee["firstname"],
            employee["lastname"]
        ])
        send("test", (employee["email"], ),
             {"msg": "%s\nYour registration has been deleted" % salut})
Example #3
0
 def location_updated(registration):
     """
     Location has been updated
     """
     employee = get_employee(registration.casy_ref)
     if employee and employee["email"]:
         salut = " ".join([
             employee["salutation_short"], employee["firstname"],
             employee["lastname"]
         ])
         send(
             "test", (employee["email"], ), {
                 "msg":
                 "%s\nLocation of the event has been changed to: %s" % (
                     salut,
                     instance.location_full,
                 )
             })
Example #4
0
 def dates_updated(registration):
     """
     Dates have been updated
     """
     employee = get_employee(registration.casy_ref)
     if employee and employee["email"]:
         salut = " ".join([
             employee["salutation_short"], employee["firstname"],
             employee["lastname"]
         ])
         send(
             "test", (employee["email"], ), {
                 "msg":
                 "%s\nDates of the event have been changed to: %s - %s" % (
                     salut,
                     instance.start_date,
                     instance.end_date,
                 )
             })
Example #5
0
def registration_save(sender, instance, using, **kwargs):  # pylint: disable=W0613
    """
    Send new registration or registration status update email to registered
    person
    """
    if not instance.pk:
        employee = get_employee(instance.casy_ref)
        if employee and employee["email"]:
            salut = " ".join([
                employee["salutation_short"], employee["firstname"],
                employee["lastname"]
            ])
            send(
                "test", (employee["email"], ), {
                    "msg":
                    "%s\nYou have new registration with status %s" % (
                        salut,
                        "Confirmed" if instance.is_confirmed else "Waiting",
                    )
                })
    else:
        try:
            obj = InternalReservation.objects.get(pk=instance.pk)
        except InternalReservation.DoesNotExist:
            obj = ExternalReservation.objects.get(pk=instance.pk)
        if instance.is_confirmed != obj.is_confirmed:
            employee = get_employee(instance.casy_ref)
            if employee and employee["email"]:
                salut = " ".join([
                    employee["salutation_short"], employee["firstname"],
                    employee["lastname"]
                ])
                send(
                    "test", (employee["email"], ), {
                        "msg":
                        "%s\nStatus of your registration has been changed to %s"
                        % (
                            salut,
                            "Confirmed"
                            if instance.is_confirmed else "Waiting",
                        )
                    })