Skip to content
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

Programs List API #374

Merged
merged 6 commits into from
May 23, 2024
Merged
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
25 changes: 25 additions & 0 deletions programs/migrations/0072_program_website_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.2.11 on 2024-05-21 17:26

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


class Migration(migrations.Migration):
dependencies = [
("translations", "0004_translation_no_auto"),
("programs", "0071_alter_program_estimated_value"),
]

operations = [
migrations.AddField(
model_name="program",
name="website_description",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="program_website_description",
to="translations.translation",
),
),
]
22 changes: 22 additions & 0 deletions programs/migrations/0073_auto_20240521_1727.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 4.2.11 on 2024-05-21 17:27
from django.db import migrations


def add_website_description(apps, schema_editor):
Program = apps.get_model("programs", "Program")
Translation = apps.get_model("translations", "Translation")

for program in Program.objects.all():
translation = Translation.objects.add_translation(
f"programs.{program.name_abbreviated}-{program.id}_website_description", "[PLACEHOLDER]"
)
Program.objects.filter(pk=program.id).update(website_description=translation.id)


class Migration(migrations.Migration):
dependencies = [
("programs", "0072_program_website_description"),
("translations", "0004_translation_no_auto"),
]

operations = [migrations.RunPython(add_website_description, migrations.RunPython.noop)]
23 changes: 23 additions & 0 deletions programs/migrations/0074_alter_program_website_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.11 on 2024-05-21 17:31

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


class Migration(migrations.Migration):
dependencies = [
("translations", "0004_translation_no_auto"),
("programs", "0073_auto_20240521_1727"),
]

operations = [
migrations.AlterField(
model_name="program",
name="website_description",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="program_website_description",
to="translations.translation",
),
),
]
25 changes: 25 additions & 0 deletions programs/migrations/0075_urgentneed_website_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.2.11 on 2024-05-21 20:54

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


class Migration(migrations.Migration):
dependencies = [
("translations", "0004_translation_no_auto"),
("programs", "0074_alter_program_website_description"),
]

operations = [
migrations.AddField(
model_name="urgentneed",
name="website_description",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="urgent_website_description",
to="translations.translation",
),
),
]
24 changes: 24 additions & 0 deletions programs/migrations/0076_auto_20240521_2055.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.11 on 2024-05-21 20:55
import uuid
from django.db import migrations


def add_estimated_value(apps, schema_editor):
UrgentNeed = apps.get_model("programs", "UrgentNeed")
Translation = apps.get_model("translations", "Translation")

for urgent_need in UrgentNeed.objects.all():
translation = Translation.objects.add_translation(
f"urgent_need.{urgent_need.external_name or uuid.uuid4()}-{urgent_need.id}_website_description",
"[PLACEHOLDER]",
)
UrgentNeed.objects.filter(pk=urgent_need.id).update(website_description=translation.id)


class Migration(migrations.Migration):
dependencies = [
("programs", "0075_urgentneed_website_description"),
("translations", "0004_translation_no_auto"),
]

operations = [migrations.RunPython(add_estimated_value, migrations.RunPython.noop)]
23 changes: 23 additions & 0 deletions programs/migrations/0077_alter_urgentneed_website_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.11 on 2024-05-21 21:02

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


class Migration(migrations.Migration):
dependencies = [
("translations", "0004_translation_no_auto"),
("programs", "0076_auto_20240521_2055"),
]

operations = [
migrations.AlterField(
model_name="urgentneed",
name="website_description",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="urgent_website_description",
to="translations.translation",
),
),
]
Loading