Skip to content

Commit 46a77df

Browse files
committed
add prompt to bank in data migration
1 parent f018c0b commit 46a77df

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

thoughtswap/thoughtswap/migrations/0003_seed_example_model_instances_20250324_0943.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ def seed_mvp(apps, schema_editor):
101101
prompt_in_bank = Prompt.objects.create(
102102
author=teacher,
103103
content="Example Prompt - Will JMU football be undefeated in the 2025 season?",
104-
in_bank=True,
105104
)
106105

107106
# create a session
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 5.0.12 on 2025-05-05 13:37
2+
3+
from django.db import migrations
4+
5+
def seed_prompt_to_bank(apps, schema_editor):
6+
Prompt = apps.get_model('thoughtswap', 'Prompt')
7+
8+
# Assuming you have a user with ID 1 to assign as the author
9+
10+
# Create a new prompt instance
11+
prompt = Prompt.objects.all().last()
12+
prompt.in_bank = True
13+
prompt.save()
14+
15+
16+
class Migration(migrations.Migration):
17+
18+
dependencies = [
19+
('thoughtswap', '0010_prompt_in_bank'),
20+
]
21+
22+
operations = [
23+
migrations.RunPython(seed_prompt_to_bank),
24+
]

0 commit comments

Comments
 (0)