21 lines
550 B
Python
21 lines
550 B
Python
# Generated by Django 4.2.17 on 2024-12-14 10:13
|
|
|
|
from django.db import migrations
|
|
|
|
def convert_old_authors(apps, schema_editor):
|
|
Course = apps.get_model('courses', 'Course')
|
|
User = apps.get_model('auth', 'User')
|
|
default_user = User.objects.get(id=1)
|
|
for course in Course.objects.all():
|
|
course.author = default_user
|
|
course.save()
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('courses', '0006_course_author'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(convert_old_authors),
|
|
]
|