Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

The same procedure as last year, Miss Sophie? Same procedure as every year, James.

Roland Geider0e713d627d47
diff --git a/wger/manager/models/setting.py b/wger/manager/models/setting.py
index fc8886402..477c79afa 100644
--- a/wger/manager/models/setting.py
+++ b/wger/manager/models/setting.py
@@ -14,6 +14,9 @@
# 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/>.
+# Standard Library
+from decimal import Decimal
+
# Django
from django.core.validators import (
MaxValueValidator,
@@ -81,7 +84,7 @@ class Setting(models.Model):
decimal_places=2,
blank=True,
null=True,
- validators=[MinValueValidator(0), MaxValueValidator(1500)],
+ validators=[MinValueValidator(Decimal(0)), MaxValueValidator(Decimal(1500))],
)
"""Planed weight for the repetitions"""
diff --git a/wger/nutrition/models/log.py b/wger/nutrition/models/log.py
index 4a9566bb9..0f51d3905 100644
--- a/wger/nutrition/models/log.py
+++ b/wger/nutrition/models/log.py
@@ -14,6 +14,9 @@
# 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/>.
+# Standard Library
+from decimal import Decimal
+
# Django
from django.core.validators import (
MaxValueValidator,
@@ -103,7 +106,7 @@ class LogItem(BaseMealItem, models.Model):
decimal_places=2,
max_digits=6,
verbose_name=_('Amount'),
- validators=[MinValueValidator(1), MaxValueValidator(1000)],
+ validators=[MinValueValidator(Decimal(1)), MaxValueValidator(Decimal(1000))],
)
"""
The amount of units
diff --git a/wger/nutrition/models/meal_item.py b/wger/nutrition/models/meal_item.py
index f6cc1314b..a2b64147b 100644
--- a/wger/nutrition/models/meal_item.py
+++ b/wger/nutrition/models/meal_item.py
@@ -16,6 +16,7 @@
# Standard Library
import logging
+from decimal import Decimal
# Django
from django.core.validators import (
@@ -70,7 +71,7 @@ class MealItem(BaseMealItem, models.Model):
decimal_places=2,
max_digits=6,
verbose_name=_('Amount'),
- validators=[MinValueValidator(1), MaxValueValidator(1000)],
+ validators=[MinValueValidator(Decimal(1)), MaxValueValidator(Decimal(1000))],
)
def __str__(self):
diff --git a/wger/weight/models.py b/wger/weight/models.py
index 4cc2c6ae7..9030039f5 100644
--- a/wger/weight/models.py
+++ b/wger/weight/models.py
@@ -1,4 +1,31 @@
-# -*- coding: utf-8 -*-
+# This file is part of wger Workout Manager <https://github.com/wger-project>.
+# Copyright (C) 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/>.
+
+# Standard Library
+from decimal import Decimal
+
+# Django
+from django.contrib.auth.models import User
+from django.core.validators import (
+ MaxValueValidator,
+ MinValueValidator,
+)
+from django.db import models
+from django.utils.translation import gettext_lazy as _
+
# This file is part of wger Workout Manager.
#
@@ -15,15 +42,6 @@
# 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/>.
-# Django
-from django.contrib.auth.models import User
-from django.core.validators import (
- MaxValueValidator,
- MinValueValidator,
-)
-from django.db import models
-from django.utils.translation import gettext_lazy as _
-
class WeightEntry(models.Model):
"""
@@ -35,7 +53,7 @@ class WeightEntry(models.Model):
verbose_name=_('Weight'),
max_digits=5,
decimal_places=2,
- validators=[MinValueValidator(30), MaxValueValidator(600)],
+ validators=[MinValueValidator(Decimal(30)), MaxValueValidator(Decimal(600))],
)
user = models.ForeignKey(
User,