Skip to content

Signals

hypha.apply.projects.signals

handle_internal_approval_projects

handle_internal_approval_projects(sender, instance, **kwargs)
Source code in hypha/apply/projects/signals.py
@receiver(post_delete, sender=PAFReviewersRole)
def handle_internal_approval_projects(sender, instance, **kwargs):
    # if last Project reviewer role
    if PAFReviewersRole.objects.count() == 0:
        for project in Project.objects.filter(status=INTERNAL_APPROVAL):
            # remove all paf approvals(approved and unapproved both)
            project.paf_approvals.all().delete()
            # update project status back to Draft
            project.status = DRAFT
            project.save(update_fields=["status"])
            # remove all tasks for internal_approval project
            remove_tasks_of_related_obj(project)