Skip to content

Instantly share code, notes, and snippets.

@driesdesmet
Created August 27, 2015 15:19
Show Gist options
  • Select an option

  • Save driesdesmet/428a03c48e96d9f1e03f to your computer and use it in GitHub Desktop.

Select an option

Save driesdesmet/428a03c48e96d9f1e03f to your computer and use it in GitHub Desktop.
Django migration not runnen
# -*- 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