def reassign(self, new_user): """ Reasignment method. Encapsulates any business rules for sending signals or issuing new commands that may be associated with a new assignment. Args: new_user: the new assigned reviewer Returns: None """ if new_user == self.reviewer: return None if self.status != Resource.PENDING: raise TransitionNotAllowed("Cannot reassign a completed review") self._status_changed = True old_reviewer = self.reviewer self.reviewer = new_user tasks.send_review_assignment_email(self) ReviewLogEntry.objects.create( review=self, review_status=self.status, action="Reassigned from {0} to {1}".format(old_reviewer, new_user), )
def review_assigned(sender, review, assigned_by, **kwargs): """ Handles the behavior after a review is assigned Args: review: the assigned review assigned_by: user who initiated assignment Returns: None """ ReviewLogEntry.objects.create( review=review, review_status=review.status, action="Assigned to {0} by {1}".format(review.reviewer, assigned_by), ) tasks.send_review_assignment_email(review)