Self hosted FLOSS fitness/workout, nutrition and weight tracker
Remove the DaysOfWeek model
Roland Geider8e1e09fd421b
diff --git a/wger/core/api/serializers.py b/wger/core/api/serializers.pyindex 3c704023f..c37ddcb6f 100644--- a/wger/core/api/serializers.py+++ b/wger/core/api/serializers.py@@ -29,7 +29,6 @@ from rest_framework.validators import UniqueValidator# wgerfrom wger.core.models import (- DaysOfWeek,Language,License,RepetitionUnit,@@ -165,16 +164,6 @@ class LanguageSerializer(serializers.ModelSerializer):]-class DaysOfWeekSerializer(serializers.ModelSerializer):- """- DaysOfWeek serializer- """-- class Meta:- model = DaysOfWeek- fields = ['day_of_week']--class LicenseSerializer(serializers.ModelSerializer):"""License serializerdiff --git a/wger/core/api/views.py b/wger/core/api/views.pyindex 262e5d572..1edc37bb7 100644--- a/wger/core/api/views.py+++ b/wger/core/api/views.py@@ -55,7 +55,6 @@ from wger import (get_version,)from wger.core.api.serializers import (- DaysOfWeekSerializer,LanguageSerializer,LicenseSerializer,RepetitionUnitSerializer,@@ -66,7 +65,6 @@ from wger.core.api.serializers import ()from wger.core.forms import UserLoginFormfrom wger.core.models import (- DaysOfWeek,Language,License,RepetitionUnit,@@ -373,19 +371,6 @@ class LanguageViewSet(viewsets.ReadOnlyModelViewSet):return super().dispatch(request, *args, **kwargs)-class DaysOfWeekViewSet(viewsets.ReadOnlyModelViewSet):- """- API endpoint for the days of the week (monday, tuesday, etc.).-- This has historical reasons, and it's better and easier to just define a simple enum- """-- queryset = DaysOfWeek.objects.all()- serializer_class = DaysOfWeekSerializer- ordering_fields = '__all__'- filterset_fields = ('day_of_week',)--class LicenseViewSet(viewsets.ReadOnlyModelViewSet):"""API endpoint for license objectsdiff --git a/wger/core/fixtures/days_of_week.json b/wger/core/fixtures/days_of_week.jsondeleted file mode 100644index cf032ad61..000000000--- a/wger/core/fixtures/days_of_week.json+++ /dev/null@@ -1,51 +0,0 @@-[- {- "pk": 1,- "model": "core.daysofweek",- "fields": {- "day_of_week": "Monday"- }- },- {- "pk": 2,- "model": "core.daysofweek",- "fields": {- "day_of_week": "Tuesday"- }- },- {- "pk": 3,- "model": "core.daysofweek",- "fields": {- "day_of_week": "Wednesday"- }- },- {- "pk": 4,- "model": "core.daysofweek",- "fields": {- "day_of_week": "Thursday"- }- },- {- "pk": 5,- "model": "core.daysofweek",- "fields": {- "day_of_week": "Friday"- }- },- {- "pk": 6,- "model": "core.daysofweek",- "fields": {- "day_of_week": "Saturday"- }- },- {- "pk": 7,- "model": "core.daysofweek",- "fields": {- "day_of_week": "Sunday"- }- }-]diff --git a/wger/core/migrations/0019_delete_daysofweek.py b/wger/core/migrations/0019_delete_daysofweek.pynew file mode 100644index 000000000..82d0d75e7--- /dev/null+++ b/wger/core/migrations/0019_delete_daysofweek.py@@ -0,0 +1,16 @@+# Generated by Django 4.2.16 on 2025-03-15 12:23++from django.db import migrations+++class Migration(migrations.Migration):+ dependencies = [+ ('manager', '0021_flexible_routines_cleanup'),+ ('core', '0018_rounding'),+ ]++ operations = [+ migrations.DeleteModel(+ name='DaysOfWeek',+ ),+ ]diff --git a/wger/core/models/__init__.py b/wger/core/models/__init__.pyindex 8b71cadd7..371e86cf2 100644--- a/wger/core/models/__init__.py+++ b/wger/core/models/__init__.py@@ -16,7 +16,6 @@# Localfrom .cache import UserCache-from .days_of_week import DaysOfWeekfrom .language import Languagefrom .license import Licensefrom .profile import UserProfilediff --git a/wger/core/models/days_of_week.py b/wger/core/models/days_of_week.pydeleted file mode 100644index 5d5547424..000000000--- a/wger/core/models/days_of_week.py+++ /dev/null@@ -1,44 +0,0 @@-# This file is part of wger Workout Manager <https://github.com/wger-project>.-# Copyright (C) 2013 - 2021 wger Team-#-# wger Workout Manager is free software: you can redistribute it and/or modify-# it under the terms of the GNU Affero General Public License as published by-# the Free Software Foundation, either version 3 of the License, or-# (at your option) any later version.-#-# wger Workout Manager is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU Affero General Public License for more details.-#-# You should have received a copy of the GNU Affero General Public License-# along with this program. If not, see <http://www.gnu.org/licenses/>.--# Django-from django.db import models-from django.utils.translation import gettext_lazy as _---class DaysOfWeek(models.Model):- """- Model for the days of the week-- This model is needed so that 'Day' can have multiple days of the week selected- """-- day_of_week = models.CharField(max_length=9, verbose_name=_('Day of the week'))-- class Meta:- """- Order by day-ID, this is needed for some DBs- """-- ordering = [- 'pk',- ]-- def __str__(self):- """- Return a more human-readable representation- """- return self.day_of_weekdiff --git a/wger/core/tests/base_testcase.py b/wger/core/tests/base_testcase.pyindex 2a52d227a..ec25479fe 100644--- a/wger/core/tests/base_testcase.py+++ b/wger/core/tests/base_testcase.py@@ -103,7 +103,6 @@ class BaseTestCase:media_root = Nonefixtures = (- 'days_of_week','gym_config','groups','setting_repetition_units',diff --git a/wger/core/tests/test_daysofweek.py b/wger/core/tests/test_daysofweek.pydeleted file mode 100644index 372f19087..000000000--- a/wger/core/tests/test_daysofweek.py+++ /dev/null@@ -1,41 +0,0 @@-# This file is part of wger Workout Manager.-#-# wger Workout Manager is free software: you can redistribute it and/or modify-# it under the terms of the GNU Affero General Public License as published by-# the Free Software Foundation, either version 3 of the License, or-# (at your option) any later version.-#-# wger Workout Manager is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU Affero General Public License-# along with Workout Manager. If not, see <http://www.gnu.org/licenses/>.--# wger-from wger.core.models import DaysOfWeek-from wger.core.tests import api_base_test-from wger.core.tests.base_testcase import WgerTestCase---class DaysOfWeekRepresentationTestCase(WgerTestCase):- """- Test the representation of a model- """-- def test_representation(self):- """- Test that the representation of an object is correct- """- self.assertEqual(f'{DaysOfWeek.objects.get(pk=1)}', 'Monday')---class DaysOfWeekApiTestCase(api_base_test.ApiBaseResourceTestCase):- """- Tests the days of week resource- """-- pk = 1- resource = DaysOfWeek- private_resource = Falsediff --git a/wger/exercises/urls.py b/wger/exercises/urls.pyindex dc7980574..adf43c113 100644--- a/wger/exercises/urls.py+++ b/wger/exercises/urls.py@@ -31,6 +31,7 @@ from wger.exercises.views import (muscles,)+# sub patterns for historypatterns_history = [path('admin-control', history.control, name='overview'),diff --git a/wger/manager/urls.py b/wger/manager/urls.pyindex dedb5fafe..fa793fb79 100644--- a/wger/manager/urls.py+++ b/wger/manager/urls.py@@ -27,6 +27,7 @@ from wger.manager.views import (routine,)+# sub patterns for templatespatterns_templates = [path(@@ -67,7 +68,6 @@ patterns_routine = [ReactView.as_view(login_required=True),name='add',),-# Note that this needs to be the no-shadow-dom variant till this issue is fixed:# https://github.com/hello-pangea/dnd/issues/425path(diff --git a/wger/tasks.py b/wger/tasks.pyindex ca0546314..81a5aa93b 100644--- a/wger/tasks.py+++ b/wger/tasks.py@@ -236,7 +236,6 @@ def load_fixtures(context, settings_path=None):call_command('loaddata', 'groups.json')call_command('loaddata', 'users.json')call_command('loaddata', 'licenses.json')- call_command('loaddata', 'days_of_week.json')call_command('loaddata', 'setting_repetition_units.json')call_command('loaddata', 'setting_weight_units.json')diff --git a/wger/urls.py b/wger/urls.pyindex 28b81beab..424d62ec9 100644--- a/wger/urls.py+++ b/wger/urls.py@@ -134,7 +134,6 @@ router.register(r'max-rir-config', manager_api_views.MaxRiRConfigViewSet, basenarouter.register(r'workoutlog', manager_api_views.WorkoutLogViewSet, basename='workoutlog')# Core app-router.register(r'daysofweek', core_api_views.DaysOfWeekViewSet, basename='daysofweek')router.register(r'language', core_api_views.LanguageViewSet, basename='language')router.register(r'license', core_api_views.LicenseViewSet, basename='license')router.register(r'userprofile', core_api_views.UserProfileViewSet, basename='userprofile')