-
Notifications
You must be signed in to change notification settings - Fork 167
remove private textanswers #2696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Generated by Django 6.0.4 on 2026-04-13 20:21 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| def rename_private_and_public_to_keep(apps, schema_editor): # pylint: disable=unused-argument | ||
| TextAnswer = apps.get_model("evaluation", "TextAnswer") | ||
| TextAnswer.objects.filter(review_decision="PR").update(review_decision="KE") | ||
| TextAnswer.objects.filter(review_decision="PU").update(review_decision="KE") | ||
|
|
||
|
|
||
| def reverse(apps, schema_editor): # pylint: disable=unused-argument | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we call it |
||
| TextAnswer = apps.get_model("evaluation", "TextAnswer") | ||
| TextAnswer.objects.filter(review_decision="KE").update(review_decision="PU") | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("evaluation", "0163_migrate_cms_links"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RemoveConstraint( | ||
| model_name="textanswer", | ||
| name="TextAnswer_review_decision_choices", | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="textanswer", | ||
| name="review_decision", | ||
| field=models.CharField( | ||
| choices=[("KE", "keep"), ("DE", "deleted"), ("UN", "undecided")], | ||
| default="UN", | ||
| max_length=2, | ||
| verbose_name="review decision for the answer", | ||
| ), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name="textanswer", | ||
| constraint=models.CheckConstraint( | ||
| condition=models.Q(("review_decision__in", ["KE", "DE", "UN"])), | ||
| name="TextAnswer_review_decision_choices", | ||
| ), | ||
| ), | ||
| migrations.RunPython(rename_private_and_public_to_keep, reverse_code=reverse), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we need to have this |
||
| ] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just put this in one migration. Semantically, this is one operation.