def log_event(self, event, user, note=''):
        participant = Participant.objects.get(workflowactivity=self, user=user,
                disabled=False)
        current_state = self.current_state()
        if event.workflow:
            # Make sure we have an event for the right workflow
            if not event.workflow == self.workflow:
                raise UnableToLogWorkflowEvent, __('The event is not associated'\
                        ' with the workflow for the WorkflowActivity')
            if event.state:
                # If the event is mandatory then it must be completed whilst in
                # the associated state
                if event.is_mandatory:
                    if not event.state == current_state.state:
                        raise UnableToLogWorkflowEvent, __('The mandatory'\
                                ' event is not associated with the current'\
                                ' state')
        if event.roles.all():
            # Make sure the participant is associated with the event
            if not event.roles.filter(pk__in=[p.id for p in participant.roles.all()]):
                raise UnableToLogWorkflowEvent, __('The participant is not'\
                        ' associated with the specified event')
        if not note:
            note=event.name
        # Good to go...
        current_state = self.current_state().state if self.current_state() else None
        deadline = self.current_state().deadline if self.current_state() else None
        wh = WorkflowHistory(
                workflowactivity=self,
                state=current_state,
                log_type=WorkflowHistory.EVENT,
                event=event,
                participant=participant,
                note=note,
                deadline=deadline
                )
        wh.save()
        return wh
Logs the occurance of an event in the WorkflowHistory of a 
dataset/ETHPy150Open ntoll/workflow/workflow/models.py/WorkflowActivity.log_event