-
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.
Rename project status committed to draft (#3223)
Fixes #3221 Add a custom migration to update the status of committed projects to avoid errors. --------- Co-authored-by: Fredrik Jonsson <[email protected]>
- Loading branch information
1 parent
cf73d75
commit 6e54aaf
Showing
9 changed files
with
66 additions
and
26 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
18 changes: 18 additions & 0 deletions
18
hypha/apply/projects/migrations/0073_alter_project_status.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,18 @@ | ||
# Generated by Django 3.2.18 on 2023-05-02 13:40 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('application_projects', '0072_pafapprovals_approved_at'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='project', | ||
name='status', | ||
field=models.TextField(choices=[('draft', 'Draft'), ('waiting_for_approval', 'Waiting for Approval'), ('contracting', 'Contracting'), ('in_progress', 'In Progress'), ('closing', 'Closing'), ('complete', 'Complete')], default='draft'), | ||
), | ||
] |
22 changes: 22 additions & 0 deletions
22
hypha/apply/projects/migrations/0074_update_projects_status_committed_to_draft.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,22 @@ | ||
# Generated by Django 3.2.17 on 2023-02-16 12:42 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def update_committed_project_status_to_draft(apps, schema_editor): | ||
Project = apps.get_model('application_projects', 'Project') | ||
|
||
for project in Project.objects.filter(status='committed'): | ||
project.status = 'draft' | ||
project.save(update_fields={'status'}) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('application_projects', '0073_alter_project_status'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(update_committed_project_status_to_draft) | ||
] |
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