@@ -0,0 +1,575 @@
+from django.core.management.base import BaseCommand, CommandError%0A%0Afrom studygroups.models import Course%0Afrom django.contrib.auth.models import User%0A%0Aclass Command(BaseCommand):%0A    help = 'Add a created_by field to all courses'%0A%0A    def handle(self, *args, **options):%0A        user1 = User.objects.get(pk=1324)%0A        courses = Course.objects.filter(created_by__isnull=True, created_at__gt=user1.date_joined)%0A        courses.update(created_by=user1)%0A        courses = Course.objects.filter(created_by__isnull=True)%0A        courses.update(created_by=User.objects.get(pk=3))%0A

Add task to fix created_by for courses without it