blob: 86d4ebad7edee3aad02a2a07dcc82b10ea74de3e [file] [log] [blame]
Mitja Nikolausd6907dd2018-10-17 14:13:06 +02001# -*- coding: utf-8 -*-
2
3"""Migrations for creating the Fairphone staff authentication group."""
4# pylint: disable=invalid-name
5
6from django.contrib.auth.models import Group
7from django.db import migrations
8
9from hiccup.allauth_adapters import FP_STAFF_GROUP_NAME
10
11
12def add_fp_staff_group(apps, schema_editor):
13 """Create the Fairphone staff group if it does not exist."""
14 # pylint: disable=unused-argument
15
16 if not Group.objects.filter(name=FP_STAFF_GROUP_NAME).exists():
17 Group.objects.create(name=FP_STAFF_GROUP_NAME)
18
19
20class Migration(migrations.Migration):
21 """Run the migration script."""
22
23 dependencies = [("crashreports", "0004_update_logfile_paths")]
24
25 operations = [migrations.RunPython(add_fp_staff_group)]