Created
August 27, 2015 15:19
-
-
Save driesdesmet/428a03c48e96d9f1e03f to your computer and use it in GitHub Desktop.
Django migration not runnen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models, migrations | |
| def mark_teachers_as_staff(apps, schema_editor): | |
| Profile = apps.get_model('profiles', 'Profile') | |
| import pdb; pdb.set_trace | |
| for profile in Profile.objects.filter(user_ptr__groups__name__in=['lesgevers', 'begeleiders']): | |
| profile.is_staff = True | |
| profile.save() | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ('profiles', '0005_auto_20150827_1538'), | |
| ] | |
| operations = [ | |
| migrations.RunPython(mark_teachers_as_staff), | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment