Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove python 2 compatibility code

Roland312433ae88d1
diff --git a/requirements.txt b/requirements.txt
index c8202edec..7ce87a8d0 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,8 +6,8 @@ bleach==3.1.4
django-bootstrap-breadcrumbs==0.9.1
django-bower==5.2.0
django-formtools>=2.0,<3.0
-django-recaptcha==2.0.4
-Django>=1.11,<2.0
+django-recaptcha==2.0.6
+Django>=3.0,<3.1
django_compressor==2.2
django_extensions>=2.1
django-sorted-m2m>=2.0
diff --git a/wger/config/models.py b/wger/config/models.py
index 54ea0f652..a05f8c88e 100644
--- a/wger/config/models.py
+++ b/wger/config/models.py
@@ -21,7 +21,6 @@ import logging
# Third Party
from django.core.cache import cache
from django.db import models
-from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
# wger
@@ -43,7 +42,6 @@ from wger.utils.cache import (
logger = logging.getLogger(__name__)
-@python_2_unicode_compatible
class LanguageConfig(models.Model):
'''
Configuration for languages
@@ -111,7 +109,6 @@ class LanguageConfig(models.Model):
super(LanguageConfig, self).delete(*args, **kwargs)
-@python_2_unicode_compatible
class GymConfig(models.Model):
'''
System wide configuration for gyms
diff --git a/wger/core/models.py b/wger/core/models.py
index 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 models
from django.db.models import IntegerField
-from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
# wger
@@ -38,7 +37,6 @@ from wger.utils.units import AbstractWeight
from wger.weight.models import WeightEntry
-@python_2_unicode_compatible
class Language(models.Model):
'''
Language of an item (exercise, workout, etc.)
@@ -98,7 +96,6 @@ def birthdate_validator(birthdate):
)
-@python_2_unicode_compatible
class UserProfile(models.Model):
GENDER_MALE = '1'
GENDER_FEMALE = '2'
@@ -503,7 +500,6 @@ by the US Department of Agriculture. It is extremely complete, with around
return self
-@python_2_unicode_compatible
class 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_compatible
class 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_compatible
class License(models.Model):
'''
License for an item (exercise, ingredient, etc.)
@@ -601,7 +595,6 @@ class License(models.Model):
return None
-@python_2_unicode_compatible
class 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_compatible
class 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.py
index 1c190bc65..47670cae2 100644
--- a/wger/exercises/models.py
+++ b/wger/exercises/models.py
@@ -32,7 +32,6 @@ from django.core.validators import MinLengthValidator
from django.db import models
from django.template.loader import render_to_string
from django.utils import translation
-from django.utils.encoding import python_2_unicode_compatible
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
@@ -54,7 +53,6 @@ from wger.utils.models import (
logger = logging.getLogger(__name__)
-@python_2_unicode_compatible
class Muscle(models.Model):
'''
Muscle an exercise works out
@@ -84,7 +82,6 @@ class Muscle(models.Model):
return False
-@python_2_unicode_compatible
class Equipment(models.Model):
'''
Equipment used or needed by an exercise
@@ -112,7 +109,6 @@ class Equipment(models.Model):
return False
-@python_2_unicode_compatible
class 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_compatible
class 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_compatible
class ExerciseComment(models.Model):
'''
Model for an exercise comment
diff --git a/wger/gym/models.py b/wger/gym/models.py
index 3ac4694d3..02cb8d75a 100644
--- a/wger/gym/models.py
+++ b/wger/gym/models.py
@@ -22,7 +22,6 @@ import uuid
from django.contrib.auth.models import User
from django.urls import reverse
from django.db import models as m
-from django.utils.encoding import python_2_unicode_compatible
from 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_compatible
class Gym(m.Model):
'''
Model for a gym
@@ -120,7 +118,6 @@ class Gym(m.Model):
return None
-@python_2_unicode_compatible
class GymConfig(m.Model):
'''
Configuration options for a gym
@@ -296,7 +293,6 @@ def gym_document_upload_dir(instance, filename):
uuid.uuid4())
-@python_2_unicode_compatible
class UserDocument(m.Model):
'''
Model for a document
@@ -378,7 +374,6 @@ class UserDocument(m.Model):
return None
-@python_2_unicode_compatible
class ContractType(m.Model):
'''
Model for a contract's type
@@ -426,7 +421,6 @@ class ContractType(m.Model):
return None
-@python_2_unicode_compatible
class ContractOption(m.Model):
'''
Model for a contract Option
@@ -476,7 +470,6 @@ class ContractOption(m.Model):
return None
-@python_2_unicode_compatible
class Contract(m.Model):
'''
Model for a member's contract in a gym
diff --git a/wger/manager/models.py b/wger/manager/models.py
index 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_compatible
from django.utils.translation import ugettext_lazy as _
from sortedm2m.fields import SortedManyToManyField
@@ -59,7 +58,6 @@ logger = logging.getLogger(__name__)
#
# Classes
#
-@python_2_unicode_compatible
class Workout(models.Model):
'''
Model for a training schedule
@@ -207,7 +205,6 @@ class ScheduleManager(models.Manager):
return (active_workout, schedule)
-@python_2_unicode_compatible
class Schedule(models.Model):
'''
Model for a workout schedule.
@@ -313,7 +310,6 @@ class Schedule(models.Model):
return end_date
-@python_2_unicode_compatible
class 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_compatible
class Day(models.Model):
'''
Model for a training day
@@ -554,7 +549,6 @@ class Day(models.Model):
'set_list': canonical_repr}
-@python_2_unicode_compatible
class 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_compatible
class 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_compatible
class 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_compatible
class WorkoutSession(models.Model):
'''
Model for a workout session
diff --git a/wger/nutrition/models.py b/wger/nutrition/models.py
index db9b5bce8..b4ad38eab 100644
--- a/wger/nutrition/models.py
+++ b/wger/nutrition/models.py
@@ -36,7 +36,6 @@ from django.db import models
from django.template.defaultfilters import slugify # django.utils.text.slugify in django 1.5!
from django.template.loader import render_to_string
from django.utils import translation
-from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
# wger
@@ -69,7 +68,6 @@ Simple approximation of energy (kcal) provided per gram or ounce
logger = logging.getLogger(__name__)
-@python_2_unicode_compatible
class NutritionPlan(models.Model):
'''
A nutrition plan
@@ -213,7 +211,6 @@ class NutritionPlan(models.Model):
return 4
-@python_2_unicode_compatible
class 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_compatible
class 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_compatible
class 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_compatible
class Meal(models.Model):
'''
A meal
@@ -577,7 +571,6 @@ class Meal(models.Model):
return nutritional_info
-@python_2_unicode_compatible
class MealItem(models.Model):
'''
An item (component) of a meal
diff --git a/wger/weight/models.py b/wger/weight/models.py
index 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_compatible
from django.utils.translation import ugettext_lazy as _
-@python_2_unicode_compatible
class WeightEntry(models.Model):
'''
Model for a weight point