new_contents: # -*- coding: utf-8 -*-
  # Generated by Django 1.10.5 on 2017-03-25 10:24
  from __future__ import unicode_literals
  
  from django.contrib.auth.models import User
  from django.db import migrations
  
  from accounts.models import Account
  
  
  def link_user_accounts(apps, schema_editor):
      '''
      Link every Django user objects to a new Account object
      '''
  
      for user in User.objects.all():
          if user.account is None:
              Account.objects.create(user=user)
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('accounts', '0005_account_cleaning'),
      ]
  
      operations = [
          migrations.RunPython(link_user_accounts),
      ]
  
subject: Add auto-link between User and Account models in migration