You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run a migration that looks like this:
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from guardian.shortcuts import assign_perm, get_objects_for_user
from django.contrib.auth import get_user_model
def setUserPerms(apps, schema_editor):
User = get_user_model()
Project = apps.get_model('api', 'Project')
for proj in Project.objects.all():
print("Setting owner permissions for "+proj.name+"//"+user.username)
user = User.objects.get(pk=proj.owner_user.pk)
assign_perm('manage_project', user, proj)
class Migration(migrations.Migration):
dependencies = [
('api', '0077_auto_20150715_0504'),
]
operations = [
migrations.RunPython(setUserPerms, reverse_code=migrations.RunPython.noop),
]
The migration runs without any errors and successfully prints to the terminal but upon inspecting the database no changes are actually made and the permissions therefore not set.
The text was updated successfully, but these errors were encountered:
I'm trying to run a migration that looks like this:
The migration runs without any errors and successfully prints to the terminal but upon inspecting the database no changes are actually made and the permissions therefore not set.
The text was updated successfully, but these errors were encountered: