Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

The default query manager now returns all objects again

Roland Geiderd846e7723067
diff --git a/extras/docker/development/Dockerfile b/extras/docker/development/Dockerfile
index 99e52e0f7..d79420f2a 100644
--- a/extras/docker/development/Dockerfile
+++ b/extras/docker/development/Dockerfile
@@ -29,9 +29,10 @@ RUN apt-get install --no-install-recommends -y \
&& pip install --upgrade pip
# Build the necessary python wheels
-# Note that the --mount is a workaround for https://github.com/rust-lang/cargo/issues/8719
-COPY requirements* ./
-RUN --mount=type=tmpfs,target=/root/.cargo pip3 wheel --no-cache-dir --wheel-dir /wheels -r requirements_docker.txt
+# Note that the --mount tmpfs is a workaround for https://github.com/rust-lang/cargo/issues/8719
+COPY requirements* .
+RUN --mount=type=tmpfs,target=/root/.cargo \
+ pip3 wheel --no-cache-dir --wheel-dir /wheels -r requirements_docker.txt
diff --git a/wger/exercises/api/views.py b/wger/exercises/api/views.py
index 82af85801..03be23e01 100644
--- a/wger/exercises/api/views.py
+++ b/wger/exercises/api/views.py
@@ -101,7 +101,7 @@ class ExerciseBaseViewSet(ModelViewSet):
For a read-only endpoint with all the information of an exercise, see /api/v2/exercisebaseinfo/
"""
- queryset = ExerciseBase.objects.all()
+ queryset = ExerciseBase.translations.all()
serializer_class = ExerciseBaseSerializer
permission_classes = (CanContributeExercises, )
ordering_fields = '__all__'
diff --git a/wger/exercises/management/commands/exercises-health-check.py b/wger/exercises/management/commands/exercises-health-check.py
index 803e1345d..0bac772d0 100644
--- a/wger/exercises/management/commands/exercises-health-check.py
+++ b/wger/exercises/management/commands/exercises-health-check.py
@@ -87,7 +87,7 @@ class Command(BaseCommand):
self.english = Language.objects.get(short_name=ENGLISH_SHORT_NAME)
- for base in ExerciseBase.all.all():
+ for base in ExerciseBase.objects.all():
self.handle_untranslated(base, delete_untranslated)
self.handle_no_english(base, delete_no_english)
self.handle_duplicate_translations(base, delete_duplicates)
diff --git a/wger/exercises/models/base.py b/wger/exercises/models/base.py
index 032c373c2..37dcd9f76 100644
--- a/wger/exercises/models/base.py
+++ b/wger/exercises/models/base.py
@@ -60,9 +60,9 @@ class ExerciseBase(AbstractLicenseModel, AbstractHistoryMixin, models.Model):
Model for an exercise base
"""
- objects = ExerciseBaseManagerTranslations()
+ objects = ExerciseBaseManagerAll()
no_translations = ExerciseBaseManagerNoTranslations()
- all = ExerciseBaseManagerAll()
+ translations = ExerciseBaseManagerTranslations()
"""
Custom Query Manager
"""
diff --git a/wger/exercises/sync.py b/wger/exercises/sync.py
index c9467f0fd..b19bb597f 100644
--- a/wger/exercises/sync.py
+++ b/wger/exercises/sync.py
@@ -82,7 +82,7 @@ def sync_exercises(
muscles = [Muscle.objects.get(pk=i['id']) for i in data['muscles']]
muscles_sec = [Muscle.objects.get(pk=i['id']) for i in data['muscles_secondary']]
- base, base_created = ExerciseBase.all.update_or_create(
+ base, base_created = ExerciseBase.objects.update_or_create(
uuid=uuid,
defaults={'category_id': category_id},
)
diff --git a/wger/exercises/tests/test_exercise_base.py b/wger/exercises/tests/test_exercise_base.py
index 337602744..ed5f444c9 100644
--- a/wger/exercises/tests/test_exercise_base.py
+++ b/wger/exercises/tests/test_exercise_base.py
@@ -146,9 +146,9 @@ class ExerciseBaseTranslationHandlingTestCase(WgerTestCase):
Exercise.objects.get(pk=5).delete()
def test_managers(self):
- self.assertEqual(ExerciseBase.objects.all().count(), 7)
+ self.assertEqual(ExerciseBase.translations.all().count(), 7)
self.assertEqual(ExerciseBase.no_translations.all().count(), 1)
- self.assertEqual(ExerciseBase.all.all().count(), 8)
+ self.assertEqual(ExerciseBase.objects.all().count(), 8)
def test_checks(self):
out = ExerciseBase.check()