
from django.db import migrations
from django.conf import settings


def delete_pending_exercises(apps, schema_editor):
    """
    Delete all pending exercises

    Note that we can't access STATUS_PENDING here because we are not using
    a real model.
    """
    Exercise = apps.get_model("exercises", "ExerciseBase")
    Exercise.objects.filter(status='1').delete()


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0014_merge_20210818_1735'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('exercises', '0017_muscle_name_en'),
    ]

    operations = [migrations.RunPython(delete_pending_exercises)]


from django.db import migrations
from django.conf import settings


def delete_pending_bases(apps, schema_editor):
    """
    Delete all pending bases

    Note that we can't access STATUS_PENDING here because we are not using
    a real model.
    """
    Base = apps.get_model("exercises", "ExerciseBase")
    Base.objects.filter(status='1').delete()


def delete_pending_translations(apps, schema_editor):
    """
    Delete all pending translations

    Note that we can't access STATUS_PENDING here because we are not using
    a real model.
    """
    Exercise = apps.get_model("exercises", "Exercise")
    Exercise.objects.filter(status='1').delete()


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0014_merge_20210818_1735'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('exercises', '0017_muscle_name_en'),
    ]

    operations = [
        migrations.RunPython(delete_pending_bases),
        migrations.RunPython(delete_pending_translations),
    ]

Delete both pending bases and translations
Delete both pending bases and translations

  
  from django.db import migrations
  from django.conf import settings
  
  
- def delete_pending_exercises(apps, schema_editor):
+ def delete_pending_bases(apps, schema_editor):
      """
-     Delete all pending exercises
+     Delete all pending bases
  
      Note that we can't access STATUS_PENDING here because we are not using
      a real model.
      """
+     Base = apps.get_model("exercises", "ExerciseBase")
+     Base.objects.filter(status='1').delete()
+ 
+ 
+ def delete_pending_translations(apps, schema_editor):
+     """
+     Delete all pending translations
+ 
+     Note that we can't access STATUS_PENDING here because we are not using
+     a real model.
+     """
-     Exercise = apps.get_model("exercises", "ExerciseBase")
+     Exercise = apps.get_model("exercises", "Exercise")
      Exercise.objects.filter(status='1').delete()
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('core', '0014_merge_20210818_1735'),
          migrations.swappable_dependency(settings.AUTH_USER_MODEL),
          ('exercises', '0017_muscle_name_en'),
      ]
  
+     operations = [
-     operations = [migrations.RunPython(delete_pending_exercises)]
+         migrations.RunPython(delete_pending_bases),
+         migrations.RunPython(delete_pending_translations),
+     ]
  
Delete both pending bases and translations
## Code Before:

from django.db import migrations
from django.conf import settings


def delete_pending_exercises(apps, schema_editor):
    """
    Delete all pending exercises

    Note that we can't access STATUS_PENDING here because we are not using
    a real model.
    """
    Exercise = apps.get_model("exercises", "ExerciseBase")
    Exercise.objects.filter(status='1').delete()


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0014_merge_20210818_1735'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('exercises', '0017_muscle_name_en'),
    ]

    operations = [migrations.RunPython(delete_pending_exercises)]

## Instruction:
Delete both pending bases and translations
## Code After:

from django.db import migrations
from django.conf import settings


def delete_pending_bases(apps, schema_editor):
    """
    Delete all pending bases

    Note that we can't access STATUS_PENDING here because we are not using
    a real model.
    """
    Base = apps.get_model("exercises", "ExerciseBase")
    Base.objects.filter(status='1').delete()


def delete_pending_translations(apps, schema_editor):
    """
    Delete all pending translations

    Note that we can't access STATUS_PENDING here because we are not using
    a real model.
    """
    Exercise = apps.get_model("exercises", "Exercise")
    Exercise.objects.filter(status='1').delete()


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0014_merge_20210818_1735'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('exercises', '0017_muscle_name_en'),
    ]

    operations = [
        migrations.RunPython(delete_pending_bases),
        migrations.RunPython(delete_pending_translations),
    ]
