Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Update migrations

Roland Geider3f3d9ae402ae
diff --git a/wger/manager/migrations/0018_flexible_routines.py b/wger/manager/migrations/0018_flexible_routines.py
index 1fe78e7b7..8ab2fa48b 100644
--- a/wger/manager/migrations/0018_flexible_routines.py
+++ b/wger/manager/migrations/0018_flexible_routines.py
@@ -45,7 +45,7 @@ class Migration(migrations.Migration):
max_length=10,
),
),
- ('name', models.CharField(max_length=20, verbose_name='Description')),
+ ('name', models.CharField(max_length=20, verbose_name='Name')),
(
'description',
models.CharField(
@@ -59,6 +59,9 @@ class Migration(migrations.Migration):
('need_logs_to_advance', models.BooleanField(default=False)),
('order', models.PositiveIntegerField(default=1, verbose_name='Order')),
],
+ options={
+ 'ordering': ['order'],
+ },
),
migrations.AddField(
model_name='workoutlog',
@@ -71,6 +74,7 @@ class Migration(migrations.Migration):
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
+ related_name='logs',
to='manager.workoutsession',
verbose_name='Session',
),
@@ -335,9 +339,8 @@ class Migration(migrations.Migration):
'operation',
models.CharField(
choices=[('+', 'Plus'), ('-', 'Minus'), ('r', 'Replace')],
- default='+',
+ default='r',
max_length=1,
- null=False,
),
),
(
@@ -346,7 +349,7 @@ class Migration(migrations.Migration):
choices=[('abs', 'Absolute'), ('percent', 'Percent')],
default='abs',
max_length=10,
- null=True,
+ null=False,
),
),
('need_log_to_apply', models.BooleanField(default=False, null=True)),
@@ -382,9 +385,8 @@ class Migration(migrations.Migration):
'operation',
models.CharField(
choices=[('+', 'Plus'), ('-', 'Minus'), ('r', 'Replace')],
- default='+',
+ default='r',
max_length=1,
- null=False,
),
),
(
@@ -393,7 +395,7 @@ class Migration(migrations.Migration):
choices=[('abs', 'Absolute'), ('percent', 'Percent')],
default='abs',
max_length=10,
- null=True,
+ null=False,
),
),
('need_log_to_apply', models.BooleanField(default=False, null=True)),
@@ -429,9 +431,8 @@ class Migration(migrations.Migration):
'operation',
models.CharField(
choices=[('+', 'Plus'), ('-', 'Minus'), ('r', 'Replace')],
- default='+',
+ default='r',
max_length=1,
- null=False,
),
),
(
@@ -440,7 +441,7 @@ class Migration(migrations.Migration):
choices=[('abs', 'Absolute'), ('percent', 'Percent')],
default='abs',
max_length=10,
- null=True,
+ null=False,
),
),
('need_log_to_apply', models.BooleanField(default=False, null=True)),
@@ -476,9 +477,8 @@ class Migration(migrations.Migration):
'operation',
models.CharField(
choices=[('+', 'Plus'), ('-', 'Minus'), ('r', 'Replace')],
- default='+',
+ default='r',
max_length=1,
- null=False,
),
),
(
@@ -487,7 +487,7 @@ class Migration(migrations.Migration):
choices=[('abs', 'Absolute'), ('percent', 'Percent')],
default='abs',
max_length=10,
- null=True,
+ null=False,
),
),
('need_log_to_apply', models.BooleanField(default=False, null=True)),
@@ -523,9 +523,8 @@ class Migration(migrations.Migration):
'operation',
models.CharField(
choices=[('+', 'Plus'), ('-', 'Minus'), ('r', 'Replace')],
- default='+',
+ default='r',
max_length=1,
- null=False,
),
),
(
@@ -534,7 +533,7 @@ class Migration(migrations.Migration):
choices=[('abs', 'Absolute'), ('percent', 'Percent')],
default='abs',
max_length=10,
- null=True,
+ null=False,
),
),
('need_log_to_apply', models.BooleanField(default=False, null=True)),
@@ -570,9 +569,8 @@ class Migration(migrations.Migration):
'operation',
models.CharField(
choices=[('+', 'Plus'), ('-', 'Minus'), ('r', 'Replace')],
- default='+',
+ default='r',
max_length=1,
- null=False,
),
),
(
@@ -581,7 +579,7 @@ class Migration(migrations.Migration):
choices=[('abs', 'Absolute'), ('percent', 'Percent')],
default='abs',
max_length=10,
- null=True,
+ null=False,
),
),
('need_log_to_apply', models.BooleanField(default=False, null=True)),
@@ -616,9 +614,8 @@ class Migration(migrations.Migration):
'operation',
models.CharField(
choices=[('+', 'Plus'), ('-', 'Minus'), ('r', 'Replace')],
- default='+',
+ default='r',
max_length=1,
- null=False,
),
),
(
@@ -627,7 +624,7 @@ class Migration(migrations.Migration):
choices=[('abs', 'Absolute'), ('percent', 'Percent')],
default='abs',
max_length=10,
- null=True,
+ null=False,
),
),
('need_log_to_apply', models.BooleanField(default=False, null=True)),
@@ -662,9 +659,8 @@ class Migration(migrations.Migration):
'operation',
models.CharField(
choices=[('+', 'Plus'), ('-', 'Minus'), ('r', 'Replace')],
- default='+',
+ default='r',
max_length=1,
- null=False,
),
),
(
@@ -673,7 +669,7 @@ class Migration(migrations.Migration):
choices=[('abs', 'Absolute'), ('percent', 'Percent')],
default='abs',
max_length=10,
- null=True,
+ null=False,
),
),
('need_log_to_apply', models.BooleanField(default=False, null=True)),
diff --git a/wger/manager/migrations/0019_flexible_routines_migration.py b/wger/manager/migrations/0019_flexible_routines_migration.py
index 72ce48353..3be4ee815 100644
--- a/wger/manager/migrations/0019_flexible_routines_migration.py
+++ b/wger/manager/migrations/0019_flexible_routines_migration.py
@@ -28,6 +28,7 @@ def migrate_routines(apps) -> dict[int, Any]:
RestConfig = apps.get_model('manager', 'RestConfig')
REPLACE_OP = 'r'
+ ABS_STEP = 'abs'
workouts_to_routines = {}
@@ -89,6 +90,7 @@ def migrate_routines(apps) -> dict[int, Any]:
value=setting.weight,
iteration=1,
operation=REPLACE_OP,
+ step=ABS_STEP,
).save()
if setting.reps:
@@ -97,6 +99,7 @@ def migrate_routines(apps) -> dict[int, Any]:
value=setting.reps,
iteration=1,
operation=REPLACE_OP,
+ step=ABS_STEP,
).save()
if setting.rir:
@@ -105,6 +108,7 @@ def migrate_routines(apps) -> dict[int, Any]:
value=setting.rir,
iteration=1,
operation=REPLACE_OP,
+ step=ABS_STEP,
).save()
RestConfig(
@@ -112,6 +116,7 @@ def migrate_routines(apps) -> dict[int, Any]:
value=120,
iteration=1,
operation=REPLACE_OP,
+ step=ABS_STEP,
).save()
SetsConfig(
@@ -119,6 +124,7 @@ def migrate_routines(apps) -> dict[int, Any]:
value=set_obj.sets,
iteration=1,
operation=REPLACE_OP,
+ step=ABS_STEP,
).save()
routine.first_day = day_dict[1]