diff options
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/migrations/0013_release_0_9_0.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/yaksh/migrations/0013_release_0_9_0.py b/yaksh/migrations/0013_release_0_9_0.py new file mode 100644 index 0000000..3f7f377 --- /dev/null +++ b/yaksh/migrations/0013_release_0_9_0.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2018-07-13 10:24 +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.AlterUniqueTogether( + name='testcaseorder', + unique_together=set([('answer_paper', 'question', 'order')]), + ), + migrations.RunPython(set_is_moderator), + ] |