from __future__ import unicode_literals
import binascii
import os

from django.db import migrations


def generate_key():
    return binascii.hexlify(os.urandom(20)).decode()


def create_auth_token(apps, schema_editor):
    Member = apps.get_model('members', 'member')
    Token = apps.get_model('authtoken', 'token')

    member = Member.objects.create(
        email='devteam+accounting@onepercentclub.com',
        username='accounting'
    )

    token = Token.objects.create(
        user=member,
        key=generate_key()
    )


class Migration(migrations.Migration):

    dependencies = [
        ('projects', '0018_merge_20170118_1533'),
        ('authtoken', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(create_auth_token)
    ]

from __future__ import unicode_literals
import binascii
import os

from django.db import migrations


def generate_key():
    return binascii.hexlify(os.urandom(20)).decode()


def create_auth_token(apps, schema_editor):
    Member = apps.get_model('members', 'member')
    Token = apps.get_model('authtoken', 'token')

    member = Member.objects.create(
        email='devteam+accounting@onepercentclub.com',
        username='accounting'
    )

    token = Token.objects.create(
        user=member,
        key=generate_key()
    )


class Migration(migrations.Migration):

    dependencies = [
        ('projects', '0018_merge_20170118_1533'),
        ('authtoken', '0001_initial'),
        ('quotes', '0005_auto_20180717_1017'),
        ('slides', '0006_auto_20180717_1017'),
    ]

    operations = [
        migrations.RunPython(create_auth_token)
    ]

Add dependency on different migrations
Add dependency on different migrations

  from __future__ import unicode_literals
  import binascii
  import os
  
  from django.db import migrations
  
  
  def generate_key():
      return binascii.hexlify(os.urandom(20)).decode()
  
  
  def create_auth_token(apps, schema_editor):
      Member = apps.get_model('members', 'member')
      Token = apps.get_model('authtoken', 'token')
  
      member = Member.objects.create(
          email='devteam+accounting@onepercentclub.com',
          username='accounting'
      )
  
      token = Token.objects.create(
          user=member,
          key=generate_key()
      )
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('projects', '0018_merge_20170118_1533'),
          ('authtoken', '0001_initial'),
+         ('quotes', '0005_auto_20180717_1017'),
+         ('slides', '0006_auto_20180717_1017'),
      ]
  
      operations = [
          migrations.RunPython(create_auth_token)
      ]
  
Add dependency on different migrations
## Code Before:
from __future__ import unicode_literals
import binascii
import os

from django.db import migrations


def generate_key():
    return binascii.hexlify(os.urandom(20)).decode()


def create_auth_token(apps, schema_editor):
    Member = apps.get_model('members', 'member')
    Token = apps.get_model('authtoken', 'token')

    member = Member.objects.create(
        email='devteam+accounting@onepercentclub.com',
        username='accounting'
    )

    token = Token.objects.create(
        user=member,
        key=generate_key()
    )


class Migration(migrations.Migration):

    dependencies = [
        ('projects', '0018_merge_20170118_1533'),
        ('authtoken', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(create_auth_token)
    ]

## Instruction:
Add dependency on different migrations
## Code After:
from __future__ import unicode_literals
import binascii
import os

from django.db import migrations


def generate_key():
    return binascii.hexlify(os.urandom(20)).decode()


def create_auth_token(apps, schema_editor):
    Member = apps.get_model('members', 'member')
    Token = apps.get_model('authtoken', 'token')

    member = Member.objects.create(
        email='devteam+accounting@onepercentclub.com',
        username='accounting'
    )

    token = Token.objects.create(
        user=member,
        key=generate_key()
    )


class Migration(migrations.Migration):

    dependencies = [
        ('projects', '0018_merge_20170118_1533'),
        ('authtoken', '0001_initial'),
        ('quotes', '0005_auto_20180717_1017'),
        ('slides', '0006_auto_20180717_1017'),
    ]

    operations = [
        migrations.RunPython(create_auth_token)
    ]
