diff options
author | maheshgudi | 2018-07-13 16:49:26 +0530 |
---|---|---|
committer | maheshgudi | 2018-07-13 16:49:26 +0530 |
commit | e7cfaf3370cfdc135ce8c5c61abf25cf16a8daad (patch) | |
tree | 6aec56ed722a5c30d088cdec93fefc471ff05614 /yaksh/migrations | |
parent | 590dc4a5e99fc1f72287d13e5ce25d1506b4e518 (diff) | |
download | online_test-e7cfaf3370cfdc135ce8c5c61abf25cf16a8daad.tar.gz online_test-e7cfaf3370cfdc135ce8c5c61abf25cf16a8daad.tar.bz2 online_test-e7cfaf3370cfdc135ce8c5c61abf25cf16a8daad.zip |
Add migration files for release v0.9
Diffstat (limited to 'yaksh/migrations')
-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), + ] |