text: # Generated by Django 2.1.7 on 2019-09-08 23:24
  
  from django.db import migrations, models
  import django.db.models.deletion
  import tqdm
  
  
  def initialize_team_field(apps, schema):
      Participant = apps.get_model('events', 'Participant')
      for p in tqdm.tqdm(Participant.objects.all()):
          teams = p.team_set.all()
          assert(len(teams) < 2)
          if teams:
              p._team = teams[0]
              p.save()
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('events', '0034_auto_20190818_1125'),
      ]
  
      operations = [
          migrations.AddField(
              model_name='participant',
              name='_team',
              field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='events.Team'),  # noqa
          ),
          migrations.RunPython(initialize_team_field),
      ]
  