Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Delete both pending bases and translations

Roland Geider4ec2672dc22c
diff --git a/wger/exercises/migrations/0018_delete_pending_exercises.py b/wger/exercises/migrations/0018_delete_pending_exercises.py
index e46a1eccf..f7aa64767 100644
--- a/wger/exercises/migrations/0018_delete_pending_exercises.py
+++ b/wger/exercises/migrations/0018_delete_pending_exercises.py
@@ -4,14 +4,25 @@ 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.
"""
- Exercise = apps.get_model("exercises", "ExerciseBase")
+ 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()
@@ -23,4 +34,7 @@ class Migration(migrations.Migration):
('exercises', '0017_muscle_name_en'),
]
- operations = [migrations.RunPython(delete_pending_exercises)]
+ operations = [
+ migrations.RunPython(delete_pending_bases),
+ migrations.RunPython(delete_pending_translations),
+ ]