Self hosted FLOSS fitness/workout, nutrition and weight tracker
Remove python 2 compatibility code
Roland312433ae88d1
diff --git a/requirements.txt b/requirements.txtindex c8202edec..7ce87a8d0 100644--- a/requirements.txt+++ b/requirements.txt@@ -6,8 +6,8 @@ bleach==3.1.4django-bootstrap-breadcrumbs==0.9.1django-bower==5.2.0django-formtools>=2.0,<3.0-django-recaptcha==2.0.4-Django>=1.11,<2.0+django-recaptcha==2.0.6+Django>=3.0,<3.1django_compressor==2.2django_extensions>=2.1django-sorted-m2m>=2.0diff --git a/wger/config/models.py b/wger/config/models.pyindex 54ea0f652..a05f8c88e 100644--- a/wger/config/models.py+++ b/wger/config/models.py@@ -21,7 +21,6 @@ import logging# Third Partyfrom django.core.cache import cachefrom django.db import models-from django.utils.encoding import python_2_unicode_compatiblefrom django.utils.translation import ugettext_lazy as _# wger@@ -43,7 +42,6 @@ from wger.utils.cache import (logger = logging.getLogger(__name__)-@python_2_unicode_compatibleclass LanguageConfig(models.Model):'''Configuration for languages@@ -111,7 +109,6 @@ class LanguageConfig(models.Model):super(LanguageConfig, self).delete(*args, **kwargs)-@python_2_unicode_compatibleclass GymConfig(models.Model):'''System wide configuration for gymsdiff --git a/wger/core/models.py b/wger/core/models.pyindex 2f16c44bf..d90f89188 100644--- a/wger/core/models.py+++ b/wger/core/models.py@@ -28,7 +28,6 @@ from django.core.validators import ()from django.db import modelsfrom django.db.models import IntegerField-from django.utils.encoding import python_2_unicode_compatiblefrom django.utils.translation import ugettext_lazy as _# wger@@ -38,7 +37,6 @@ from wger.utils.units import AbstractWeightfrom wger.weight.models import WeightEntry-@python_2_unicode_compatibleclass Language(models.Model):'''Language of an item (exercise, workout, etc.)@@ -98,7 +96,6 @@ def birthdate_validator(birthdate):)-@python_2_unicode_compatibleclass UserProfile(models.Model):GENDER_MALE = '1'GENDER_FEMALE = '2'@@ -503,7 +500,6 @@ by the US Department of Agriculture. It is extremely complete, with aroundreturn self-@python_2_unicode_compatibleclass UserCache(models.Model):'''A table used to cache expensive queries or similar@@ -529,7 +525,6 @@ class UserCache(models.Model):return u"Cache for user {0}".format(self.user)-@python_2_unicode_compatibleclass DaysOfWeek(models.Model):'''Model for the days of the week@@ -553,7 +548,6 @@ class DaysOfWeek(models.Model):return self.day_of_week-@python_2_unicode_compatibleclass License(models.Model):'''License for an item (exercise, ingredient, etc.)@@ -601,7 +595,6 @@ class License(models.Model):return None-@python_2_unicode_compatibleclass RepetitionUnit(models.Model):'''Setting unit, used in combination with an amount such as '10 reps', '5 km'@@ -640,7 +633,6 @@ class RepetitionUnit(models.Model):return self.id == 1-@python_2_unicode_compatibleclass WeightUnit(models.Model):'''Weight unit, used in combination with an amount such as '10 kg', '5 plates'diff --git a/wger/exercises/models.py b/wger/exercises/models.pyindex 1c190bc65..47670cae2 100644--- a/wger/exercises/models.py+++ b/wger/exercises/models.py@@ -32,7 +32,6 @@ from django.core.validators import MinLengthValidatorfrom django.db import modelsfrom django.template.loader import render_to_stringfrom django.utils import translation-from django.utils.encoding import python_2_unicode_compatiblefrom django.utils.text import slugifyfrom django.utils.translation import ugettext_lazy as _@@ -54,7 +53,6 @@ from wger.utils.models import (logger = logging.getLogger(__name__)-@python_2_unicode_compatibleclass Muscle(models.Model):'''Muscle an exercise works out@@ -84,7 +82,6 @@ class Muscle(models.Model):return False-@python_2_unicode_compatibleclass Equipment(models.Model):'''Equipment used or needed by an exercise@@ -112,7 +109,6 @@ class Equipment(models.Model):return False-@python_2_unicode_compatibleclass ExerciseCategory(models.Model):'''Model for an exercise category@@ -160,7 +156,6 @@ class ExerciseCategory(models.Model):super(ExerciseCategory, self).delete(*args, **kwargs)-@python_2_unicode_compatibleclass Exercise(AbstractSubmissionModel, AbstractLicenseModel, models.Model):'''Model for an exercise@@ -473,7 +468,6 @@ class ExerciseImage(AbstractSubmissionModel, AbstractLicenseModel, models.Model)fail_silently=True)-@python_2_unicode_compatibleclass ExerciseComment(models.Model):'''Model for an exercise commentdiff --git a/wger/gym/models.py b/wger/gym/models.pyindex 3ac4694d3..02cb8d75a 100644--- a/wger/gym/models.py+++ b/wger/gym/models.py@@ -22,7 +22,6 @@ import uuidfrom django.contrib.auth.models import Userfrom django.urls import reversefrom django.db import models as m-from django.utils.encoding import python_2_unicode_compatiblefrom django.utils.translation import (ugettext,ugettext_lazy as _@@ -32,7 +31,6 @@ from django.utils.translation import (from wger.gym.managers import GymManager-@python_2_unicode_compatibleclass Gym(m.Model):'''Model for a gym@@ -120,7 +118,6 @@ class Gym(m.Model):return None-@python_2_unicode_compatibleclass GymConfig(m.Model):'''Configuration options for a gym@@ -296,7 +293,6 @@ def gym_document_upload_dir(instance, filename):uuid.uuid4())-@python_2_unicode_compatibleclass UserDocument(m.Model):'''Model for a document@@ -378,7 +374,6 @@ class UserDocument(m.Model):return None-@python_2_unicode_compatibleclass ContractType(m.Model):'''Model for a contract's type@@ -426,7 +421,6 @@ class ContractType(m.Model):return None-@python_2_unicode_compatibleclass ContractOption(m.Model):'''Model for a contract Option@@ -476,7 +470,6 @@ class ContractOption(m.Model):return None-@python_2_unicode_compatibleclass Contract(m.Model):'''Model for a member's contract in a gymdiff --git a/wger/manager/models.py b/wger/manager/models.pyindex 45019c33a..7176808a6 100644--- a/wger/manager/models.py+++ b/wger/manager/models.py@@ -33,7 +33,6 @@ from django.core.validators import (MinValueValidator)from django.db import models-from django.utils.encoding import python_2_unicode_compatiblefrom django.utils.translation import ugettext_lazy as _from sortedm2m.fields import SortedManyToManyField@@ -59,7 +58,6 @@ logger = logging.getLogger(__name__)## Classes#-@python_2_unicode_compatibleclass Workout(models.Model):'''Model for a training schedule@@ -207,7 +205,6 @@ class ScheduleManager(models.Manager):return (active_workout, schedule)-@python_2_unicode_compatibleclass Schedule(models.Model):'''Model for a workout schedule.@@ -313,7 +310,6 @@ class Schedule(models.Model):return end_date-@python_2_unicode_compatibleclass ScheduleStep(models.Model):'''Model for a step in a workout schedule.@@ -378,7 +374,6 @@ class ScheduleStep(models.Model):return start_date, end_date-@python_2_unicode_compatibleclass Day(models.Model):'''Model for a training day@@ -554,7 +549,6 @@ class Day(models.Model):'set_list': canonical_repr}-@python_2_unicode_compatibleclass Set(models.Model):'''Model for a set of exercises@@ -607,7 +601,6 @@ class Set(models.Model):super(Set, self).delete(*args, **kwargs)-@python_2_unicode_compatibleclass Setting(models.Model):'''Settings for an exercise (weight, reps, etc.)@@ -693,7 +686,6 @@ class Setting(models.Model):return self.set.exerciseday.training-@python_2_unicode_compatibleclass WorkoutLog(models.Model):'''A log entry for an exercise@@ -794,7 +786,6 @@ class WorkoutLog(models.Model):super(WorkoutLog, self).delete(*args, **kwargs)-@python_2_unicode_compatibleclass WorkoutSession(models.Model):'''Model for a workout sessiondiff --git a/wger/nutrition/models.py b/wger/nutrition/models.pyindex db9b5bce8..b4ad38eab 100644--- a/wger/nutrition/models.py+++ b/wger/nutrition/models.py@@ -36,7 +36,6 @@ from django.db import modelsfrom django.template.defaultfilters import slugify # django.utils.text.slugify in django 1.5!from django.template.loader import render_to_stringfrom django.utils import translation-from django.utils.encoding import python_2_unicode_compatiblefrom django.utils.translation import ugettext_lazy as _# wger@@ -69,7 +68,6 @@ Simple approximation of energy (kcal) provided per gram or ouncelogger = logging.getLogger(__name__)-@python_2_unicode_compatibleclass NutritionPlan(models.Model):'''A nutrition plan@@ -213,7 +211,6 @@ class NutritionPlan(models.Model):return 4-@python_2_unicode_compatibleclass Ingredient(AbstractSubmissionModel, AbstractLicenseModel, models.Model):'''An ingredient, with some approximate nutrition values@@ -450,7 +447,6 @@ class Ingredient(AbstractSubmissionModel, AbstractLicenseModel, models.Model):return False-@python_2_unicode_compatibleclass WeightUnit(models.Model):'''A more human usable weight unit (spoon, table, slice...)@@ -480,7 +476,6 @@ class WeightUnit(models.Model):return None-@python_2_unicode_compatibleclass IngredientWeightUnit(models.Model):'''A specific human usable weight unit for an ingredient@@ -515,7 +510,6 @@ class IngredientWeightUnit(models.Model):self.gram)-@python_2_unicode_compatibleclass Meal(models.Model):'''A meal@@ -577,7 +571,6 @@ class Meal(models.Model):return nutritional_info-@python_2_unicode_compatibleclass MealItem(models.Model):'''An item (component) of a mealdiff --git a/wger/weight/models.py b/wger/weight/models.pyindex b69f97c4d..79a2bfc27 100644--- a/wger/weight/models.py+++ b/wger/weight/models.py@@ -22,11 +22,9 @@ from django.core.validators import (MinValueValidator)from django.db import models-from django.utils.encoding import python_2_unicode_compatiblefrom django.utils.translation import ugettext_lazy as _-@python_2_unicode_compatibleclass WeightEntry(models.Model):'''Model for a weight point