Files
MathApp/content/migrations/0015_seed_subjects.py
Zareian 8cb1ecb85e Subjects per grade (math, calculus, geometry, stats, discrete), 5 new textbooks, 202 new islands, long islands split, hand-written figures and lesson texts for the new books
- content.Subject + Unit.subject, /api/home?subject=, tutor grounded in the chosen book
- 5 new books ingested; ~1150 hand-written questions, islands named by hand
- node_split: islands over 7 lessons split into parts of <=6 (lesson ids and progress kept)
- Lesson.figures hand-authored and visually checked for 653 lessons of the new books;
  gen_lesson_figures got --subject and survives network errors
- seed files re-exported

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 05:35:18 +03:30

25 lines
1.1 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from django.db import migrations
# رنگ‌ها جدا از رنگِ پایه‌ها (Grade.color) و از هم‌اند تا دکمه‌های نوارِ کتاب‌ها در نقشه
# به‌چشم یک مسیرِ جدا بیایند. آیکون‌ها نامِ lucide‌اند (همان فهرستی که نقشه می‌شناسد).
SUBJECTS = [
('math', 'ریاضی', 'Sigma', '#ED6956', 1),
('calculus', 'حسابان', 'LineChart', '#00BCD4', 2),
('geometry', 'هندسه', 'Compass', '#9B7BFF', 3),
('stats', 'آمار و احتمال', 'BarChart3', '#FF7A3D', 4),
('discrete', 'گسسته', 'Network', '#5FBF8F', 5),
]
def create_subjects(apps, schema_editor):
Subject = apps.get_model('content', 'Subject')
for key, title, icon, color, order in SUBJECTS:
Subject.objects.get_or_create(
key=key, defaults={'title': title, 'icon': icon, 'color': color, 'order': order},
)
class Migration(migrations.Migration):
dependencies = [('content', '0014_subject')]
operations = [migrations.RunPython(create_subjects, migrations.RunPython.noop)]