(instance, recipient_type, recipient_id)
return new_instance
We can copy alert schedule instances for any recipient because the
        recipient's time zone doesn't factor into the calculation of the
        next event due timestamp as it does for timed schedule instances.
We can copy alert schedule instances for any recipient because the
        recipient's time zone doesn't factor into the calculation of the
        next event due timestamp as it does for timed schedule instances.
We can copy alert schedule instances for any recipient because the recipient s time zone doesn t factor into the calculation of the next event due timestamp as it does for timed schedule instances .
def copy_for_recipient(instance, recipient_type, recipient_id):
        """
        We can copy alert schedule instances for any recipient because the
        recipient's time zone doesn't factor into the calculation of the
        next event due timestamp as it does for timed schedule instances.
        """
        if not isinstance(instance, AbstractAlertScheduleInstance):
            raise TypeError("Expected an alert schedule instance")

        new_instance = type(instance)()

        for field in instance._meta.fields:
            if field.name not in ['schedule_instance_id', 'recipient_type', 'recipient_id']:
                setattr(new_instance, field.name, getattr(instance, field.name))

        new_instance.recipient_type = recipient_type
        new_instance.recipient_id = recipient_id

        return new_instance
def copy_for_recipient ( instance , recipient_type , recipient_id ) : if not isinstance ( instance , AbstractAlertScheduleInstance ) : raise TypeError ( "Expected an alert schedule instance" ) new_instance = type ( instance ) ( ) for field in instance . _meta . fields : if field . name not in [ 'schedule_instance_id' , 'recipient_type' , 'recipient_id' ] : setattr ( new_instance , field . name , getattr ( instance , field . name ) ) new_instance . recipient_type = recipient_type new_instance . recipient_id = recipient_id return new_instance