-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/enhancement/merge-project-app-co…
…mms' into test
- Loading branch information
Showing
11 changed files
with
80 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
hypha/apply/projects/migrations/0097_move_project_comments_to_application.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 4.2.17 on 2025-01-07 17:57 | ||
|
||
from django.db import migrations | ||
from hypha.apply.activity.models import COMMENT | ||
|
||
|
||
def migrate_project_comments_to_application(apps, schema_editor): | ||
Activity = apps.get_model("activity", "Activity") | ||
ContentType = apps.get_model("contenttypes", "ContentType") | ||
Project = apps.get_model("application_projects", "Project") | ||
ApplicationSubmission = apps.get_model("funds", "ApplicationSubmission") | ||
project_type = ContentType.objects.get_for_model(Project) | ||
application_type = ContentType.objects.get_for_model(ApplicationSubmission) | ||
for comment in Activity.objects.filter( | ||
type=COMMENT, source_content_type=project_type | ||
): | ||
application = Project.objects.get(id=comment.source_object_id).submission | ||
comment.source_content_type = application_type | ||
comment.source_object_id = application.id | ||
comment.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("application_projects", "0096_remove_invoicedeliverable_deliverable_and_more"), | ||
] | ||
|
||
operations = [migrations.RunPython(migrate_project_comments_to_application)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters