Skip to content
Snippets Groups Projects
Commit ebe80874 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

removing addition of EM advocates group through auth migrations, adding new...

removing addition of EM advocates group through auth migrations, adding new auto-generate auth migration
parent 0bf707f0
No related branches found
No related tags found
1 merge request!6Rework migrations
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
advocate_usernames = [
'branson.stephens@LIGO.ORG',
'sean.mcwilliams@LIGO.ORG',
'leo.singer@LIGO.ORG',
'samaya.nissanke@LIGO.ORG',
'massimiliano.razzano@LIGO.ORG',
'giuseppe.greco@LIGO.ORG',
'barbara.patricelli@LIGO.ORG',
'peter.shawhan@LIGO.ORG',
'kendall.ackley@LIGO.ORG',
'alexander.urban@LIGO.ORG',
'daniel.holz@LIGO.ORG',
'b.sathyaprakash@LIGO.ORG',
'hsin-yu.chen@LIGO.ORG',
'sergei.klimenko@LIGO.ORG',
'yiming.hu@LIGO.ORG',
'adam.zadrozny@LIGO.ORG',
'roy.williams@LIGO.ORG',
'marica.branchesi@LIGO.ORG',
'benjamin.farr@LIGO.ORG',
'shaon.ghosh@LIGO.ORG',
'eric.chassandemottin@LIGO.ORG',
'reed.essick@LIGO.ORG',
'eric.howell@LIGO.ORG',
'vassiliki.kalogera@LIGO.ORG',
'david.coward@LIGO.ORG',
'xilong.fan@LIGO.ORG',
'akos.szolgyen@LIGO.ORG',
]
def add_advocates_group_and_users(apps, schema_editor):
from django.conf import settings
User = apps.get_model("auth", "User")
Group = apps.get_model("auth", "Group")
advocates = Group.objects.create(name=settings.EM_ADVOCATE_GROUP)
for username in advocate_usernames:
try:
user = User.objects.get(username=username)
advocates.user_set.add(user)
except:
pass
class Migration(migrations.Migration):
dependencies = [
('auth', '0007_auto_20150708_1134'),
]
operations = [
migrations.RunPython(add_advocates_group_and_users),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-20 15:45
from __future__ import unicode_literals
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth', '0007_auto_20150708_1134'),
]
operations = [
migrations.AlterField(
model_name='permission',
name='content_type',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType', verbose_name='content type'),
),
migrations.AlterField(
model_name='user',
name='username',
field=models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.ASCIIUsernameValidator()], verbose_name='username'),
),
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment