# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2018-07-13 14:16 from __future__ import unicode_literals from django.db import migrations, models import yaksh.models def set_is_moderator(apps, schema_editor): """ Set is_moderator to True for all users that belong to Moderator group """ Profile = apps.get_model('yaksh', 'Profile') for prof in Profile.objects.all(): user = prof.user if user.groups.filter(name='moderator').exists(): prof.is_moderator = True prof.save() class Migration(migrations.Migration): dependencies = [ ('yaksh', '0012_release_0_8_1'), ] operations = [ migrations.AddField( model_name='lesson', name='video_file', field=models.FileField(blank=True, default=None, help_text='Please upload video files in mp4, ogv, webm format', null=True, upload_to=yaksh.models.get_file_dir), ), migrations.AddField( model_name='profile', name='is_moderator', field=models.BooleanField(default=False), ), migrations.AlterField( model_name='lessonfile', name='file', field=models.FileField(default=None, upload_to=yaksh.models.get_file_dir), ), migrations.RunPython(set_is_moderator), ]