from __future__ import unicode_literals

from django.db import migrations


def forwards(apps, schema_editor):
    DualText = apps.get_model('testmigrate', 'DualText')
    for obj in DualText.objects.all():
        obj.value_dual = obj.value


def backwards(apps, schema_editor):
    DualText = apps.get_model('testmigrate', 'DualText')
    for obj in DualText.objects.all():
        obj.value = obj.value_dual


class Migration(migrations.Migration):

    dependencies = [
        ('testmigrate', '0003_add_value_dual'),
    ]

    operations = [
        migrations.RunPython(forwards, backwards),
    ]

from __future__ import unicode_literals

from django.db import migrations


def forwards(apps, schema_editor):
    DualText = apps.get_model('testmigrate', 'DualText')
    for obj in DualText.objects.all():
        obj.value_dual = obj.value
        obj.save(force_update=True)


def backwards(apps, schema_editor):
    DualText = apps.get_model('testmigrate', 'DualText')
    for obj in DualText.objects.all():
        obj.value = obj.value_dual
        obj.save(force_update=True)


class Migration(migrations.Migration):

    dependencies = [
        ('testmigrate', '0003_add_value_dual'),
    ]

    operations = [
        migrations.RunPython(forwards, backwards),
    ]

Fix test migration to actually save updates.
Fix test migration to actually save updates.

  from __future__ import unicode_literals
  
  from django.db import migrations
  
  
  def forwards(apps, schema_editor):
      DualText = apps.get_model('testmigrate', 'DualText')
      for obj in DualText.objects.all():
          obj.value_dual = obj.value
+         obj.save(force_update=True)
  
  
  def backwards(apps, schema_editor):
      DualText = apps.get_model('testmigrate', 'DualText')
      for obj in DualText.objects.all():
          obj.value = obj.value_dual
+         obj.save(force_update=True)
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('testmigrate', '0003_add_value_dual'),
      ]
  
      operations = [
          migrations.RunPython(forwards, backwards),
      ]
  
Fix test migration to actually save updates.
## Code Before:
from __future__ import unicode_literals

from django.db import migrations


def forwards(apps, schema_editor):
    DualText = apps.get_model('testmigrate', 'DualText')
    for obj in DualText.objects.all():
        obj.value_dual = obj.value


def backwards(apps, schema_editor):
    DualText = apps.get_model('testmigrate', 'DualText')
    for obj in DualText.objects.all():
        obj.value = obj.value_dual


class Migration(migrations.Migration):

    dependencies = [
        ('testmigrate', '0003_add_value_dual'),
    ]

    operations = [
        migrations.RunPython(forwards, backwards),
    ]

## Instruction:
Fix test migration to actually save updates.
## Code After:
from __future__ import unicode_literals

from django.db import migrations


def forwards(apps, schema_editor):
    DualText = apps.get_model('testmigrate', 'DualText')
    for obj in DualText.objects.all():
        obj.value_dual = obj.value
        obj.save(force_update=True)


def backwards(apps, schema_editor):
    DualText = apps.get_model('testmigrate', 'DualText')
    for obj in DualText.objects.all():
        obj.value = obj.value_dual
        obj.save(force_update=True)


class Migration(migrations.Migration):

    dependencies = [
        ('testmigrate', '0003_add_value_dual'),
    ]

    operations = [
        migrations.RunPython(forwards, backwards),
    ]
