Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Generated by Django 5.2.11 on 2026-02-27 16:14

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("activity", "0088_activity_deleted"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.AlterField(
model_name="activity",
name="user",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
),
),
migrations.AlterField(
model_name="event",
name="by",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
migrations.AlterField(
model_name="event",
name="type",
field=models.CharField(
choices=[
("UPDATE_LEAD", "updated lead"),
("BATCH_UPDATE_LEAD", "batch updated lead"),
("EDIT_SUBMISSION", "edited submission"),
("APPLICANT_EDIT", "edited applicant"),
("NEW_SUBMISSION", "submitted new submission"),
("DRAFT_SUBMISSION", "submitted new draft submission"),
("SCREENING", "screened"),
("TRANSITION", "transitioned"),
("BATCH_TRANSITION", "batch transitioned"),
("DETERMINATION_OUTCOME", "sent determination outcome"),
("BATCH_DETERMINATION_OUTCOME", "sent batch determination outcome"),
("INVITED_TO_PROPOSAL", "invited to proposal"),
("REVIEWERS_UPDATED", "updated reviewers"),
("BATCH_REVIEWERS_UPDATED", "batch updated reviewers"),
("PARTNERS_UPDATED", "updated partners"),
("PARTNERS_UPDATED_PARTNER", "partners updated partner"),
("READY_FOR_REVIEW", "marked ready for review"),
("BATCH_READY_FOR_REVIEW", "marked batch ready for review"),
("NEW_REVIEW", "added new review"),
("COMMENT", "added comment"),
("PROPOSAL_SUBMITTED", "submitted proposal"),
("OPENED_SEALED", "opened sealed submission"),
("REVIEW_OPINION", "reviewed opinion"),
("DELETE_SUBMISSION", "deleted submission"),
("ANONYMIZE_SUBMISSION", "anonymized submission"),
("DELETE_REVIEW", "deleted review"),
("DELETE_REVIEW_OPINION", "deleted review opinion"),
("CREATED_PROJECT", "created project"),
("UPDATE_PROJECT_LEAD", "updated project lead"),
("UPDATE_PROJECT_TITLE", "updated project title"),
("EDIT_REVIEW", "edited review"),
("SEND_FOR_APPROVAL", "sent for approval"),
("APPROVE_PROJECT", "approved project"),
("ASSIGN_PAF_APPROVER", "assign project form approver"),
("APPROVE_PAF", "approved project form"),
("PROJECT_TRANSITION", "transitioned project"),
("REQUEST_PROJECT_CHANGE", "requested project change"),
("SUBMIT_CONTRACT_DOCUMENTS", "submitted contract documents"),
("UPLOAD_DOCUMENT", "uploaded document to project"),
("UPLOAD_CONTRACT", "uploaded contract to project"),
("APPROVE_CONTRACT", "approved contract"),
("CREATE_INVOICE", "created invoice for project"),
("UPDATE_INVOICE_STATUS", "updated invoice status"),
("APPROVE_INVOICE", "approve invoice"),
("DELETE_INVOICE", "deleted invoice"),
("SENT_TO_COMPLIANCE", "sent project to compliance"),
("UPDATE_INVOICE", "updated invoice"),
("SUBMIT_REPORT", "submitted report"),
("SKIPPED_REPORT", "skipped report"),
("REPORT_FREQUENCY_CHANGED", "changed report frequency"),
("DISABLED_REPORTING", "disabled reporting"),
("REPORT_NOTIFY", "notified report"),
("REVIEW_REMINDER", "reminder to review"),
("BATCH_DELETE_SUBMISSION", "batch deleted submissions"),
("BATCH_SKELETON_SUBMISSION", "batch anonymized submissions"),
("BATCH_ARCHIVE_SUBMISSION", "batch archive submissions"),
("BATCH_INVOICE_STATUS_UPDATE", "batch update invoice status"),
("STAFF_ACCOUNT_CREATED", "created new account"),
("STAFF_ACCOUNT_EDITED", "edited account"),
("ARCHIVE_SUBMISSION", "archived submission"),
("UNARCHIVE_SUBMISSION", "unarchived submission"),
("REMOVE_TASK", "remove task"),
("INVITE_COAPPLICANT", "invite co-applicant"),
],
max_length=50,
verbose_name="verb",
),
),
]
4 changes: 2 additions & 2 deletions hypha/apply/activity/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def get_absolute_url(self):
class Activity(models.Model):
timestamp = models.DateTimeField()
type = models.CharField(choices=ACTIVITY_TYPES.items(), max_length=30)
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT)
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)

source_content_type = models.ForeignKey(
ContentType,
Expand Down Expand Up @@ -373,7 +373,7 @@ class Event(models.Model):
when = models.DateTimeField(auto_now_add=True)
type = models.CharField(_("verb"), choices=MESSAGES.choices, max_length=50)
by = models.ForeignKey(
settings.AUTH_USER_MODEL, on_delete=models.PROTECT, null=True
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True
)
content_type = models.ForeignKey(
ContentType, blank=True, null=True, on_delete=models.CASCADE
Expand Down
5 changes: 5 additions & 0 deletions hypha/apply/activity/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class MESSAGES(TextChoices):
OPENED_SEALED = "OPENED_SEALED", _("opened sealed submission")
REVIEW_OPINION = "REVIEW_OPINION", _("reviewed opinion")
DELETE_SUBMISSION = "DELETE_SUBMISSION", _("deleted submission")
ANONYMIZE_SUBMISSION = "ANONYMIZE_SUBMISSION", _("anonymized submission")
DELETE_REVIEW = "DELETE_REVIEW", _("deleted review")
DELETE_REVIEW_OPINION = "DELETE_REVIEW_OPINION", _("deleted review opinion")
CREATED_PROJECT = "CREATED_PROJECT", _("created project")
Expand Down Expand Up @@ -66,6 +67,10 @@ class MESSAGES(TextChoices):
REPORT_NOTIFY = "REPORT_NOTIFY", _("notified report")
REVIEW_REMINDER = "REVIEW_REMINDER", _("reminder to review")
BATCH_DELETE_SUBMISSION = "BATCH_DELETE_SUBMISSION", _("batch deleted submissions")
BATCH_SKELETON_SUBMISSION = (
"BATCH_SKELETON_SUBMISSION",
_("batch anonymized submissions"),
)
BATCH_ARCHIVE_SUBMISSION = (
"BATCH_ARCHIVE_SUBMISSION",
_("batch archive submissions"),
Expand Down
24 changes: 24 additions & 0 deletions hypha/apply/funds/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import nh3
from django import forms
from django.conf import settings
from django.db.models import Q
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
Expand Down Expand Up @@ -495,6 +496,29 @@ class Meta:
fields = ["invited_user_email", "submission"]


class DeleteSubmissionForm(forms.Form):
# Alpine.js code added as an attribute to update confirmation text (ie. when a user has to type `delete` to finalize deletion)
anon_or_delete = forms.ChoiceField(
choices=[
("ANONYMIZE", "Anonymize submission"),
("DELETE", "Delete submission"),
],
widget=forms.RadioSelect(
attrs={
"class": "text-sm radio-sm",
"@click": "mode = $el.value.toLowerCase()",
}
),
initial="ANONYMIZE",
required=False,
)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if not settings.SUBMISSION_SKELETONING_ENABLED:
del self.fields["anon_or_delete"]


class EditCoApplicantForm(forms.ModelForm):
role = forms.ChoiceField(
choices=CoApplicantRole.choices, label="Role", required=False
Expand Down
89 changes: 0 additions & 89 deletions hypha/apply/funds/management/commands/drafts_cleanup.py

This file was deleted.

Loading
Loading