25 lines
640 B
Python
25 lines
640 B
Python
# Generated by Django 3.0.5 on 2020-04-27 16:00
|
|
|
|
from django.db import migrations
|
|
from django_scopes import scopes_disabled
|
|
|
|
|
|
def apply_migration(apps, schema_editor):
|
|
with scopes_disabled():
|
|
Group = apps.get_model('auth', 'Group')
|
|
User = apps.get_model('auth', 'User')
|
|
for u in User.objects.all():
|
|
if u.groups.count() < 1:
|
|
u.groups.add(Group.objects.get(name='admin'))
|
|
u.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
('cookbook', '0035_auto_20200427_1637'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(apply_migration)
|
|
]
|