def finish(self, **kwargs):
    assert (self.instance.status == self.instance.STATUS_STARTED)
    if (not self.instance.finished_at):
        self.instance.finished_at = timezone.now()
    self.instance.status = self.instance.STATUS_DONE
    self.instance.modified_by = kwargs.get('user', None)
    self.instance.save()
    self._instantiate_next_activities()
def finish(self, **kwargs):
    assert (self.instance.status == self.instance.STATUS_STARTED)
    if (not self.instance.finished_at):
        self.instance.finished_at = timezone.now()
    self.instance.status = self.instance.STATUS_DONE
    self.instance.modified_by = kwargs.get('user', None)
    self.instance.save()
    self._instantiate_next_activities()