Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Sorted imports

Peter van der Does736635b6b09d
diff --git a/manage.py b/manage.py
index d5c1c05be..d55df6793 100644
--- a/manage.py
+++ b/manage.py
@@ -1,13 +1,18 @@
#!/usr/bin/env python
+
+# Standard Library
import sys
+# Third Party
from django.core.management import execute_from_command_line
+# wger
from wger.tasks import (
- setup_django_environment,
- get_user_config_path
+ get_user_config_path,
+ setup_django_environment
)
+
if __name__ == "__main__":
# If user passed the settings flag ignore the default wger settings
diff --git a/setup.cfg b/setup.cfg
index 67bd1fec6..6d4afa19f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -14,3 +14,67 @@ putty-ignore =
**/exercises/apps.py : F401
**/gym/apps.py : F401
**/manager/apps.py : F401
+
+[isort]
+sections = FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
+skip: extras,build,dist,node_modules,migrations,docs,settings.py
+
+# If set to true - ensures that if a star import is present, nothing else is
+# imported from that namespace.
+combine_star=False
+
+# If set to true - imports will be sorted by their length instead of
+# alphabetically.
+length_sort=False
+
+# An integer that represents the longest line-length you want a single import to
+# take. Defaults to 80.
+line_length=119
+
+# A comment to consistently place directly above future imports.
+import_heading_future=Future
+
+# A comment to consistently place directly above imports from the standard library.
+import_heading_stdlib=Standard Library
+
+# A comment to consistently place directly above thirdparty imports.
+import_heading_thirdparty=Third Party
+
+# A comment to consistently place directly above imports from the current
+# project.
+import_heading_firstparty=wger
+
+# A comment to consistently place directly above imports that start with '.'.
+import_heading_localfolder=Local
+
+# An integer that represents the number of spaces you would like to indent by or
+# Tab to indent by a single tab.
+indent=' '
+
+# A list of imports that will be forced to display withing the first party
+# category.
+known_first_party=wger
+
+# An integer that represents how you want imports to be displayed if their long
+# enough to span multiple lines. A full definition of all possible modes can be
+# found in isort's README.
+multi_line_output=3
+force_grid_wrap=True
+
+# If set to true - isort will create separate sections withing "from" imports
+# for CONSTANTS, Classes, and modules/functions.
+order_by_type=True
+
+# Forces a certain number of lines after the imports and before the first line
+# of functional code. By default this is 2 lines if the first line of code is a
+# class or function. Otherwise it's 1.
+lines_after_imports=2
+
+# If set to true - isort will combine as imports on the same line within for
+# import statements. By default isort forces all as imports to display on their
+# own lines.
+combine_as_imports=True
+
+# If set to true - isort will add imports even if the file specified is
+# currently completely empty.
+force_adds=False
diff --git a/setup.py b/setup.py
index 1c10d52a7..153050d89 100644
--- a/setup.py
+++ b/setup.py
@@ -7,10 +7,13 @@
:license: GNU GPL, see LICENSE for more details.
"""
+# Third Party
from setuptools import (
- setup,
- find_packages
+ find_packages,
+ setup
)
+
+# wger
from wger import get_version
diff --git a/wger/__main__.py b/wger/__main__.py
index 1b36fcb76..ff4bbeba2 100644
--- a/wger/__main__.py
+++ b/wger/__main__.py
@@ -14,10 +14,14 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import os
import sys
+
+# Third Party
from invoke import run
+
'''
This simple wrapper script is used as a console entry point in the packaged
version of the application. It simply redirects all arguments to the invoke
diff --git a/wger/config/apps.py b/wger/config/apps.py
index 3e1a7b9a7..dc093f300 100644
--- a/wger/config/apps.py
+++ b/wger/config/apps.py
@@ -14,6 +14,7 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.apps import AppConfig
diff --git a/wger/config/models.py b/wger/config/models.py
index 91924ca12..2299dd9b4 100644
--- a/wger/config/models.py
+++ b/wger/config/models.py
@@ -15,18 +15,29 @@
# 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/>.
+# Standard Library
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 _
-from django.core.cache import cache
-from wger.core.models import Language, UserProfile
-from wger.gym.helpers import is_any_gym_admin
-from wger.gym.models import Gym, GymUserConfig
-from wger.utils.cache import delete_template_fragment_cache
-from wger.utils.cache import cache_mapper
+# wger
+from wger.core.models import (
+ Language,
+ UserProfile
+)
+from wger.gym.helpers import is_any_gym_admin
+from wger.gym.models import (
+ Gym,
+ GymUserConfig
+)
+from wger.utils.cache import (
+ cache_mapper,
+ delete_template_fragment_cache
+)
logger = logging.getLogger(__name__)
diff --git a/wger/config/signals.py b/wger/config/signals.py
index 3f4933676..dcbbaac15 100644
--- a/wger/config/signals.py
+++ b/wger/config/signals.py
@@ -15,9 +15,11 @@
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.db.models.signals import post_save
from django.dispatch import receiver
+# wger
from wger.config.models import LanguageConfig
from wger.core.models import Language
diff --git a/wger/config/tests/test_custom_header.py b/wger/config/tests/test_custom_header.py
index 7520da6dc..dac822e90 100644
--- a/wger/config/tests/test_custom_header.py
+++ b/wger/config/tests/test_custom_header.py
@@ -15,10 +15,12 @@
# 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/>.
+# Third Party
from django.core.urlresolvers import reverse
-from wger.gym.models import Gym
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
+from wger.gym.models import Gym
class GymNameHeaderTestCase(WorkoutManagerTestCase):
diff --git a/wger/config/tests/test_gym_config.py b/wger/config/tests/test_gym_config.py
index 461c59f14..d81218e84 100644
--- a/wger/config/tests/test_gym_config.py
+++ b/wger/config/tests/test_gym_config.py
@@ -15,13 +15,18 @@
# 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/>.
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+# wger
from wger.config.models import GymConfig
from wger.core.models import UserProfile
from wger.core.tests.base_testcase import WorkoutManagerTestCase
-from wger.gym.models import Gym, GymUserConfig
+from wger.gym.models import (
+ Gym,
+ GymUserConfig
+)
class GymConfigTestCase(WorkoutManagerTestCase):
diff --git a/wger/config/tests/test_language_config.py b/wger/config/tests/test_language_config.py
index 0c5119c70..fda4ec5ad 100644
--- a/wger/config/tests/test_language_config.py
+++ b/wger/config/tests/test_language_config.py
@@ -15,8 +15,8 @@
# 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.config.models import LanguageConfig
-
from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
diff --git a/wger/config/urls.py b/wger/config/urls.py
index de61a91e1..08722b5fc 100644
--- a/wger/config/urls.py
+++ b/wger/config/urls.py
@@ -15,10 +15,17 @@
# 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/>.
-from django.conf.urls import url, include
-
-from wger.config.views import language_config
-from wger.config.views import gym_config
+# Third Party
+from django.conf.urls import (
+ include,
+ url
+)
+
+# wger
+from wger.config.views import (
+ gym_config,
+ language_config
+)
# sub patterns for language configs
diff --git a/wger/config/views/gym_config.py b/wger/config/views/gym_config.py
index e4a817ffb..7ccd9292e 100644
--- a/wger/config/views/gym_config.py
+++ b/wger/config/views/gym_config.py
@@ -14,12 +14,18 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.core.urlresolvers import reverse, reverse_lazy
+# Third Party
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
from django.utils.translation import ugettext as _
from django.views.generic import UpdateView
+# wger
from wger.config.models import GymConfig
from wger.utils.generic_views import WgerFormMixin
diff --git a/wger/config/views/language_config.py b/wger/config/views/language_config.py
index f4f1825fb..7ada04d81 100644
--- a/wger/config/views/language_config.py
+++ b/wger/config/views/language_config.py
@@ -14,13 +14,22 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
-from django.core.urlresolvers import reverse, reverse_lazy
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
from django.utils.translation import ugettext as _
from django.views.generic import UpdateView
+# wger
from wger.config.models import LanguageConfig
from wger.utils.generic_views import WgerFormMixin
diff --git a/wger/core/api/resources.py b/wger/core/api/resources.py
index c5d5141fa..3553121f1 100644
--- a/wger/core/api/resources.py
+++ b/wger/core/api/resources.py
@@ -14,17 +14,19 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from tastypie.authentication import ApiKeyAuthentication
from tastypie.constants import ALL
from tastypie.resources import ModelResource
-from wger.utils.resources import UserObjectsOnlyAuthorization
+# wger
from wger.core.models import (
- UserProfile,
- Language,
DaysOfWeek,
- License
+ Language,
+ License,
+ UserProfile
)
+from wger.utils.resources import UserObjectsOnlyAuthorization
class UserProfileResource(ModelResource):
diff --git a/wger/core/api/serializers.py b/wger/core/api/serializers.py
index 0ee7362df..b0456b2d0 100644
--- a/wger/core/api/serializers.py
+++ b/wger/core/api/serializers.py
@@ -15,15 +15,18 @@
# 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/>.
+# Third Party
from rest_framework import serializers
+# wger
from wger.core.models import (
- UserProfile,
- Language,
DaysOfWeek,
+ Language,
License,
RepetitionUnit,
- WeightUnit)
+ UserProfile,
+ WeightUnit
+)
class UserprofileSerializer(serializers.ModelSerializer):
diff --git a/wger/core/api/views.py b/wger/core/api/views.py
index 54ef0f580..9f2c649fa 100644
--- a/wger/core/api/views.py
+++ b/wger/core/api/views.py
@@ -15,28 +15,34 @@
# 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/>.
+# Third Party
from django.contrib.auth.models import User
from rest_framework import viewsets
-from rest_framework.response import Response
from rest_framework.decorators import detail_route
+from rest_framework.response import Response
-from wger.core.models import (
- UserProfile,
- Language,
- DaysOfWeek,
- License,
- RepetitionUnit,
- WeightUnit)
+# wger
from wger.core.api.serializers import (
- UsernameSerializer,
- LanguageSerializer,
DaysOfWeekSerializer,
+ LanguageSerializer,
LicenseSerializer,
RepetitionUnitSerializer,
+ UsernameSerializer,
+ UserprofileSerializer,
WeightUnitSerializer
)
-from wger.core.api.serializers import UserprofileSerializer
-from wger.utils.permissions import UpdateOnlyPermission, WgerPermission
+from wger.core.models import (
+ DaysOfWeek,
+ Language,
+ License,
+ RepetitionUnit,
+ UserProfile,
+ WeightUnit
+)
+from wger.utils.permissions import (
+ UpdateOnlyPermission,
+ WgerPermission
+)
class UserProfileViewSet(viewsets.ModelViewSet):
diff --git a/wger/core/apps.py b/wger/core/apps.py
index 4596b9757..6ae7a28ec 100644
--- a/wger/core/apps.py
+++ b/wger/core/apps.py
@@ -14,6 +14,7 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.apps import AppConfig
diff --git a/wger/core/demo.py b/wger/core/demo.py
index ad7e04585..be41076dd 100644
--- a/wger/core/demo.py
+++ b/wger/core/demo.py
@@ -14,36 +14,39 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
+import datetime
import logging
import random
-import datetime
import uuid
-from django.contrib.auth.models import User
+# Third Party
from django.contrib.auth import authenticate
+from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
-from wger.weight.models import WeightEntry
-from wger.exercises.models import Exercise
+# wger
from wger.core.models import DaysOfWeek
+from wger.exercises.models import Exercise
from wger.manager.models import (
- Workout,
Day,
+ Schedule,
+ ScheduleStep,
Set,
Setting,
- WorkoutLog,
- Schedule,
- ScheduleStep
+ Workout,
+ WorkoutLog
)
from wger.nutrition.models import (
- NutritionPlan,
+ Ingredient,
+ IngredientWeightUnit,
Meal,
MealItem,
- Ingredient,
- IngredientWeightUnit
+ NutritionPlan
)
-
from wger.utils.language import load_language
+from wger.weight.models import WeightEntry
+
logger = logging.getLogger(__name__)
diff --git a/wger/core/forms.py b/wger/core/forms.py
index ff116b31c..6211654d5 100644
--- a/wger/core/forms.py
+++ b/wger/core/forms.py
@@ -14,19 +14,25 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from captcha.fields import ReCaptchaField
-from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
+from django import forms
+from django.contrib.auth.forms import (
+ AuthenticationForm,
+ UserCreationForm
+)
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
-from django import forms
from django.forms import (
+ CharField,
EmailField,
Form,
- CharField,
- widgets,
- PasswordInput
+ PasswordInput,
+ widgets
)
from django.utils.translation import ugettext as _
+
+# wger
from wger.core.models import UserProfile
diff --git a/wger/core/management/commands/clear-cache.py b/wger/core/management/commands/clear-cache.py
index 1cf089680..90e9f2a14 100644
--- a/wger/core/management/commands/clear-cache.py
+++ b/wger/core/management/commands/clear-cache.py
@@ -14,16 +14,24 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.contrib.auth.models import User
-from django.core.management.base import BaseCommand, CommandError
from django.core.cache import cache
+from django.core.management.base import (
+ BaseCommand,
+ CommandError
+)
+# wger
from wger.core.models import Language
-from wger.manager.models import Workout, WorkoutLog
+from wger.manager.models import (
+ Workout,
+ WorkoutLog
+)
from wger.utils.cache import (
+ delete_template_fragment_cache,
reset_workout_canonical_form,
- reset_workout_log,
- delete_template_fragment_cache
+ reset_workout_log
)
diff --git a/wger/core/management/commands/delete-temp-users.py b/wger/core/management/commands/delete-temp-users.py
index 27e17bc8b..7750ca2d5 100644
--- a/wger/core/management/commands/delete-temp-users.py
+++ b/wger/core/management/commands/delete-temp-users.py
@@ -14,10 +14,14 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
-from django.utils.timezone import now
+# Third Party
from django.core.management.base import BaseCommand
+from django.utils.timezone import now
+
+# wger
from wger.core.models import UserProfile
diff --git a/wger/core/management/commands/extract-i18n.py b/wger/core/management/commands/extract-i18n.py
index d2b370e64..ca366b948 100644
--- a/wger/core/management/commands/extract-i18n.py
+++ b/wger/core/management/commands/extract-i18n.py
@@ -14,13 +14,15 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.management.base import BaseCommand
+# wger
from wger.core.models import RepetitionUnit
from wger.exercises.models import (
+ Equipment,
ExerciseCategory,
- Muscle,
- Equipment
+ Muscle
)
diff --git a/wger/core/management/commands/update-user-cache.py b/wger/core/management/commands/update-user-cache.py
index 337d8b845..4b09f09e3 100644
--- a/wger/core/management/commands/update-user-cache.py
+++ b/wger/core/management/commands/update-user-cache.py
@@ -14,9 +14,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
+# wger
from wger.gym.helpers import get_user_last_activity
diff --git a/wger/core/models.py b/wger/core/models.py
index 6b7cc92af..c2ae5bf55 100644
--- a/wger/core/models.py
+++ b/wger/core/models.py
@@ -14,22 +14,27 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
import decimal
-from django.db import models
-from django.db.models import IntegerField
+# Third Party
from django.contrib.auth.models import User
-from django.core.urlresolvers import reverse
from django.core.exceptions import ValidationError
-from django.core.validators import MinValueValidator, MaxValueValidator
+from django.core.urlresolvers import reverse
+from django.core.validators import (
+ MaxValueValidator,
+ MinValueValidator
+)
+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 _
-from wger.gym.models import Gym
+# wger
+from wger.gym.models import Gym
from wger.utils.constants import TWOPLACES
from wger.utils.units import AbstractWeight
-
from wger.weight.models import WeightEntry
diff --git a/wger/core/signals.py b/wger/core/signals.py
index bd6d3239f..3bead145c 100644
--- a/wger/core/signals.py
+++ b/wger/core/signals.py
@@ -15,10 +15,15 @@
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.contrib.auth.models import User
from django.db.models.signals import post_save
-from wger.core.models import UserProfile, UserCache
+# wger
+from wger.core.models import (
+ UserCache,
+ UserProfile
+)
from wger.utils.helpers import disable_for_loaddata
diff --git a/wger/core/templatetags/wger_extras.py b/wger/core/templatetags/wger_extras.py
index aa55d7b26..80a2e92ed 100644
--- a/wger/core/templatetags/wger_extras.py
+++ b/wger/core/templatetags/wger_extras.py
@@ -14,6 +14,7 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django import template
from django.conf import settings
from django.forms.widgets import (
@@ -22,19 +23,21 @@ from django.forms.widgets import (
)
from django.utils.safestring import mark_safe
from django.utils.translation import (
- ugettext_lazy as _,
- pgettext
+ pgettext,
+ ugettext_lazy as _
)
+# wger
from wger.utils.constants import (
PAGINATION_MAX_TOTAL_PAGES,
PAGINATION_PAGES_AROUND_CURRENT
)
from wger.utils.widgets import (
- BootstrapSelectMultipleTranslatedOriginal,
- BootstrapSelectMultiple
+ BootstrapSelectMultiple,
+ BootstrapSelectMultipleTranslatedOriginal
)
+
register = template.Library()
diff --git a/wger/core/tests/api_base_test.py b/wger/core/tests/api_base_test.py
index 2cb18753d..fe9e2bb6f 100644
--- a/wger/core/tests/api_base_test.py
+++ b/wger/core/tests/api_base_test.py
@@ -13,10 +13,12 @@
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.contrib.auth.models import User
from rest_framework import status
from rest_framework.test import APITestCase
+# wger
from wger.core.tests.base_testcase import BaseTestCase
diff --git a/wger/core/tests/base_testcase.py b/wger/core/tests/base_testcase.py
index 1eb6e6978..6065036e6 100644
--- a/wger/core/tests/base_testcase.py
+++ b/wger/core/tests/base_testcase.py
@@ -12,18 +12,24 @@
#
# You should have received a copy of the GNU Affero General Public License
-import six
-import os
+# Standard Library
import decimal
import logging
-import tempfile
+import os
import shutil
+import tempfile
-from django.core.urlresolvers import reverse
-from django.core.urlresolvers import NoReverseMatch
-from django.core.cache import cache
+# Third Party
+import six
from django.conf import settings
+from django.core.cache import cache
+from django.core.urlresolvers import (
+ NoReverseMatch,
+ reverse
+)
from django.test import TestCase
+
+# wger
from wger.utils.constants import TWOPLACES
diff --git a/wger/core/tests/test_apikey.py b/wger/core/tests/test_apikey.py
index d7a376531..ecb0d8834 100644
--- a/wger/core/tests/test_apikey.py
+++ b/wger/core/tests/test_apikey.py
@@ -12,14 +12,18 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from rest_framework.authtoken.models import Token
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
+
logger = logging.getLogger(__name__)
diff --git a/wger/core/tests/test_change_password.py b/wger/core/tests/test_change_password.py
index d35d84e04..984a1383e 100644
--- a/wger/core/tests/test_change_password.py
+++ b/wger/core/tests/test_change_password.py
@@ -12,13 +12,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
+
logger = logging.getLogger(__name__)
diff --git a/wger/core/tests/test_daysofweek.py b/wger/core/tests/test_daysofweek.py
index 22d3e8673..2b23417f5 100644
--- a/wger/core/tests/test_daysofweek.py
+++ b/wger/core/tests/test_daysofweek.py
@@ -13,6 +13,7 @@
# 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 WorkoutManagerTestCase
diff --git a/wger/core/tests/test_delete_user.py b/wger/core/tests/test_delete_user.py
index 8fac34f0d..fbe5c6e2a 100644
--- a/wger/core/tests/test_delete_user.py
+++ b/wger/core/tests/test_delete_user.py
@@ -12,13 +12,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
+
logger = logging.getLogger(__name__)
diff --git a/wger/core/tests/test_feedback.py b/wger/core/tests/test_feedback.py
index 55a083a51..0de724c85 100644
--- a/wger/core/tests/test_feedback.py
+++ b/wger/core/tests/test_feedback.py
@@ -12,9 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core import mail
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
diff --git a/wger/core/tests/test_index.py b/wger/core/tests/test_index.py
index ca92f6e95..c63995cd0 100644
--- a/wger/core/tests/test_index.py
+++ b/wger/core/tests/test_index.py
@@ -13,8 +13,10 @@
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.manager.models import Workout
from wger.nutrition.models import NutritionPlan
diff --git a/wger/core/tests/test_language.py b/wger/core/tests/test_language.py
index be56f563f..4dd3b9a9a 100644
--- a/wger/core/tests/test_language.py
+++ b/wger/core/tests/test_language.py
@@ -15,14 +15,19 @@
# 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/>.
+# Third Party
from django.core.urlresolvers import reverse_lazy
+# wger
from wger.core.models import Language
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import WorkoutManagerAccessTestCase
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase, WorkoutManagerTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAccessTestCase,
+ WorkoutManagerAddTestCase,
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
class LanguageRepresentationTestCase(WorkoutManagerTestCase):
diff --git a/wger/core/tests/test_license.py b/wger/core/tests/test_license.py
index 5780cbb41..95500bfa3 100644
--- a/wger/core/tests/test_license.py
+++ b/wger/core/tests/test_license.py
@@ -13,12 +13,16 @@
# 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 License
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import WorkoutManagerAccessTestCase, WorkoutManagerTestCase
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAccessTestCase,
+ WorkoutManagerAddTestCase,
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
class LicenseRepresentationTestCase(WorkoutManagerTestCase):
diff --git a/wger/core/tests/test_preferences.py b/wger/core/tests/test_preferences.py
index f44e545a2..62d8e5677 100644
--- a/wger/core/tests/test_preferences.py
+++ b/wger/core/tests/test_preferences.py
@@ -12,17 +12,21 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
import decimal
import logging
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.utils.constants import TWOPLACES
from wger.weight.models import WeightEntry
+
logger = logging.getLogger(__name__)
diff --git a/wger/core/tests/test_registration.py b/wger/core/tests/test_registration.py
index 8cf5322c4..43dcbedad 100644
--- a/wger/core/tests/test_registration.py
+++ b/wger/core/tests/test_registration.py
@@ -12,15 +12,21 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
-from wger.core.forms import RegistrationForm
-from wger.core.forms import RegistrationFormNoCaptcha
+# wger
+from wger.core.forms import (
+ RegistrationForm,
+ RegistrationFormNoCaptcha
+)
from wger.core.tests.base_testcase import WorkoutManagerTestCase
+
logger = logging.getLogger(__name__)
diff --git a/wger/core/tests/test_repetition_unit.py b/wger/core/tests/test_repetition_unit.py
index e144dfb16..6a3ef7f93 100644
--- a/wger/core/tests/test_repetition_unit.py
+++ b/wger/core/tests/test_repetition_unit.py
@@ -13,15 +13,15 @@
# 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 RepetitionUnit
from wger.core.tests import api_base_test
-
from wger.core.tests.base_testcase import (
WorkoutManagerAccessTestCase,
- WorkoutManagerTestCase,
+ WorkoutManagerAddTestCase,
WorkoutManagerDeleteTestCase,
WorkoutManagerEditTestCase,
- WorkoutManagerAddTestCase
+ WorkoutManagerTestCase
)
diff --git a/wger/core/tests/test_robots_txt.py b/wger/core/tests/test_robots_txt.py
index 4fb401971..776fb1abe 100644
--- a/wger/core/tests/test_robots_txt.py
+++ b/wger/core/tests/test_robots_txt.py
@@ -12,9 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
import six
from django.core.urlresolvers import reverse
+# wger
from wger.core.models import Language
from wger.core.tests.base_testcase import WorkoutManagerTestCase
diff --git a/wger/core/tests/test_sitemap.py b/wger/core/tests/test_sitemap.py
index e0225f5f8..a2e55f2ea 100644
--- a/wger/core/tests/test_sitemap.py
+++ b/wger/core/tests/test_sitemap.py
@@ -12,8 +12,10 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
diff --git a/wger/core/tests/test_spaceless.py b/wger/core/tests/test_spaceless.py
index 0bdbfd06d..1b1985f2f 100644
--- a/wger/core/tests/test_spaceless.py
+++ b/wger/core/tests/test_spaceless.py
@@ -12,12 +12,19 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.template import Template, Context
+# Third Party
+from django.template import (
+ Context,
+ Template
+)
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
+
logger = logging.getLogger(__name__)
diff --git a/wger/core/tests/test_temporary_users.py b/wger/core/tests/test_temporary_users.py
index 9c9db25d6..449c597e6 100644
--- a/wger/core/tests/test_temporary_users.py
+++ b/wger/core/tests/test_temporary_users.py
@@ -12,22 +12,32 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
import random
+# Third Party
from django.contrib.auth.models import User
from django.core.management import call_command
from django.core.urlresolvers import reverse
-from wger.core.demo import create_demo_entries, create_temporary_user
+# wger
+from wger.core.demo import (
+ create_demo_entries,
+ create_temporary_user
+)
from wger.core.tests.base_testcase import WorkoutManagerTestCase
-from wger.manager.models import (Day,
- Schedule,
- ScheduleStep,
- Workout,
- WorkoutLog)
-from wger.nutrition.models import Meal
-from wger.nutrition.models import NutritionPlan
+from wger.manager.models import (
+ Day,
+ Schedule,
+ ScheduleStep,
+ Workout,
+ WorkoutLog
+)
+from wger.nutrition.models import (
+ Meal,
+ NutritionPlan
+)
from wger.weight.models import WeightEntry
diff --git a/wger/core/tests/test_user.py b/wger/core/tests/test_user.py
index d0b391931..8ccbe94c6 100644
--- a/wger/core/tests/test_user.py
+++ b/wger/core/tests/test_user.py
@@ -12,13 +12,18 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.contrib.auth.models import User
-from django.core.urlresolvers import reverse, reverse_lazy
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+# wger
from wger.core.tests.base_testcase import (
- WorkoutManagerTestCase,
+ WorkoutManagerAccessTestCase,
WorkoutManagerEditTestCase,
- WorkoutManagerAccessTestCase
+ WorkoutManagerTestCase
)
diff --git a/wger/core/tests/test_weight_unit.py b/wger/core/tests/test_weight_unit.py
index a61347584..1d0105f99 100644
--- a/wger/core/tests/test_weight_unit.py
+++ b/wger/core/tests/test_weight_unit.py
@@ -13,15 +13,15 @@
# 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 WeightUnit
from wger.core.tests import api_base_test
-
from wger.core.tests.base_testcase import (
WorkoutManagerAccessTestCase,
- WorkoutManagerTestCase,
+ WorkoutManagerAddTestCase,
WorkoutManagerDeleteTestCase,
WorkoutManagerEditTestCase,
- WorkoutManagerAddTestCase
+ WorkoutManagerTestCase
)
diff --git a/wger/core/urls.py b/wger/core/urls.py
index c80d9c101..71ba32d77 100644
--- a/wger/core/urls.py
+++ b/wger/core/urls.py
@@ -15,23 +15,26 @@
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.conf.urls import (
- url,
- include
+ include,
+ url
)
-from django.views.generic import TemplateView
from django.contrib.auth import views
from django.core.urlresolvers import reverse_lazy
+from django.views.generic import TemplateView
+# wger
from wger.core.views import (
- user,
- misc,
- license,
languages,
+ license,
+ misc,
repetition_units,
+ user,
weight_units
)
+
# sub patterns for languages
patterns_language = [
url(r'^list$',
diff --git a/wger/core/views/languages.py b/wger/core/views/languages.py
index 8f24cff9c..6768d4142 100644
--- a/wger/core/views/languages.py
+++ b/wger/core/views/languages.py
@@ -14,21 +14,31 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
-
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- ListView,
CreateView,
- DetailView,
DeleteView,
+ DetailView,
+ ListView,
UpdateView
)
+# wger
from wger.core.models import Language
from wger.utils.generic_views import (
WgerDeleteMixin,
diff --git a/wger/core/views/license.py b/wger/core/views/license.py
index 85d73b40c..cb977d708 100644
--- a/wger/core/views/license.py
+++ b/wger/core/views/license.py
@@ -14,26 +14,36 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- ListView,
- DeleteView,
CreateView,
+ DeleteView,
+ ListView,
UpdateView
)
+# wger
+from wger.core.models import License
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
-from wger.core.models import License
-
logger = logging.getLogger(__name__)
diff --git a/wger/core/views/misc.py b/wger/core/views/misc.py
index ce242ab37..a8afd70f8 100644
--- a/wger/core/views/misc.py
+++ b/wger/core/views/misc.py
@@ -14,30 +14,41 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.conf import settings
-from django.shortcuts import render
-from django.http import HttpResponseRedirect
-from django.core.exceptions import ObjectDoesNotExist
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.core import mail
-from django.utils.translation import ugettext as _
-from django.views.generic.edit import FormView
-from django.views.generic import TemplateView
from django.contrib import messages
-from django.contrib.auth.decorators import login_required
from django.contrib.auth import login as django_login
+from django.contrib.auth.decorators import login_required
+from django.core import mail
+from django.core.exceptions import ObjectDoesNotExist
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.http import HttpResponseRedirect
+from django.shortcuts import render
from django.template.loader import render_to_string
+from django.utils.translation import ugettext as _
+from django.views.generic import TemplateView
+from django.views.generic.edit import FormView
-
-from wger.core.forms import FeedbackRegisteredForm, FeedbackAnonymousForm
-from wger.core.demo import create_demo_entries, create_temporary_user
+# wger
+from wger.core.demo import (
+ create_demo_entries,
+ create_temporary_user
+)
+from wger.core.forms import (
+ FeedbackAnonymousForm,
+ FeedbackRegisteredForm
+)
from wger.core.models import DaysOfWeek
from wger.manager.models import Schedule
from wger.nutrition.models import NutritionPlan
-from wger.weight.models import WeightEntry
from wger.weight.helpers import get_last_entries
+from wger.weight.models import WeightEntry
logger = logging.getLogger(__name__)
diff --git a/wger/core/views/repetition_units.py b/wger/core/views/repetition_units.py
index c5db98eea..8aa2e4e29 100644
--- a/wger/core/views/repetition_units.py
+++ b/wger/core/views/repetition_units.py
@@ -14,26 +14,34 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.core.urlresolvers import reverse_lazy
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
from django.http import HttpResponseForbidden
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- ListView,
- DeleteView,
CreateView,
+ DeleteView,
+ ListView,
UpdateView
)
+# wger
+from wger.core.models import RepetitionUnit
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
-from wger.core.models import RepetitionUnit
logger = logging.getLogger(__name__)
diff --git a/wger/core/views/user.py b/wger/core/views/user.py
index f335a810a..612d6f765 100644
--- a/wger/core/views/user.py
+++ b/wger/core/views/user.py
@@ -14,55 +14,80 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.shortcuts import render, get_object_or_404
-from django.http import HttpResponseRedirect, HttpResponseForbidden
-from django.template.context_processors import csrf
-from django.core.urlresolvers import reverse
-from django.utils.translation import ugettext as _, ugettext_lazy
-from django.utils import translation
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
-from django.contrib.auth import authenticate
-from django.contrib.auth import login as django_login
-from django.contrib.auth import logout as django_logout
+# Third Party
+from django.conf import settings
+from django.contrib import messages
+from django.contrib.auth import (
+ authenticate,
+ login as django_login,
+ logout as django_logout
+)
from django.contrib.auth.decorators import login_required
-from django.contrib.auth.models import User as Django_User, User
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
+from django.contrib.auth.models import User
from django.contrib.auth.views import login as django_loginview
-from django.contrib import messages
+from django.core.urlresolvers import reverse
+from django.http import (
+ HttpResponseForbidden,
+ HttpResponseRedirect
+)
+from django.shortcuts import (
+ get_object_or_404,
+ render
+)
+from django.template.context_processors import csrf
+from django.utils import translation
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- RedirectView,
- UpdateView,
DetailView,
- ListView
+ ListView,
+ RedirectView,
+ UpdateView
)
-from django.conf import settings
from rest_framework.authtoken.models import Token
-from wger.utils.constants import USER_TAB
-from wger.utils.generic_views import WgerFormMixin, WgerMultiplePermissionRequiredMixin
-from wger.utils.user_agents import check_request_amazon, check_request_android
+# wger
+from wger.config.models import GymConfig
from wger.core.forms import (
- UserPreferencesForm,
- UserPersonalInformationForm,
PasswordConfirmationForm,
RegistrationForm,
RegistrationFormNoCaptcha,
- UserLoginForm)
+ UserLoginForm,
+ UserPersonalInformationForm,
+ UserPreferencesForm
+)
from wger.core.models import Language
+from wger.gym.models import (
+ AdminUserNote,
+ Contract,
+ GymUserConfig
+)
from wger.manager.models import (
+ Workout,
WorkoutLog,
- WorkoutSession,
- Workout
+ WorkoutSession
)
from wger.nutrition.models import NutritionPlan
-from wger.config.models import GymConfig
-from wger.weight.models import WeightEntry
-from wger.gym.models import (
- AdminUserNote,
- GymUserConfig,
- Contract
+from wger.utils.constants import USER_TAB
+from wger.utils.generic_views import (
+ WgerFormMixin,
+ WgerMultiplePermissionRequiredMixin
+)
+from wger.utils.user_agents import (
+ check_request_amazon,
+ check_request_android
)
+from wger.weight.models import WeightEntry
+
logger = logging.getLogger(__name__)
@@ -224,9 +249,9 @@ def registration(request):
username = form.cleaned_data['username']
password = form.cleaned_data['password1']
email = form.cleaned_data['email']
- user = Django_User.objects.create_user(username,
- email,
- password)
+ user = User.objects.create_user(username,
+ email,
+ password)
user.save()
# Pre-set some values of the user's profile
diff --git a/wger/core/views/weight_units.py b/wger/core/views/weight_units.py
index c3e57b5b4..53d966722 100644
--- a/wger/core/views/weight_units.py
+++ b/wger/core/views/weight_units.py
@@ -14,26 +14,34 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.core.urlresolvers import reverse_lazy
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
from django.http import HttpResponseForbidden
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- ListView,
- DeleteView,
CreateView,
+ DeleteView,
+ ListView,
UpdateView
)
+# wger
+from wger.core.models import WeightUnit
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
-from wger.core.models import WeightUnit
logger = logging.getLogger(__name__)
diff --git a/wger/email/apps.py b/wger/email/apps.py
index d0ecd6102..49f435257 100644
--- a/wger/email/apps.py
+++ b/wger/email/apps.py
@@ -14,6 +14,7 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.apps import AppConfig
diff --git a/wger/email/forms.py b/wger/email/forms.py
index a176b950b..7bdc0acfa 100644
--- a/wger/email/forms.py
+++ b/wger/email/forms.py
@@ -15,12 +15,13 @@
# You should have received a copy of the GNU Affero General Public License
-from django.utils.translation import pgettext
+# Third Party
from django.forms import (
- Form,
CharField,
+ Form,
Textarea
)
+from django.utils.translation import pgettext
class EmailListForm(Form):
diff --git a/wger/email/management/commands/send-mass-emails.py b/wger/email/management/commands/send-mass-emails.py
index 658640038..2e58a1a7a 100644
--- a/wger/email/management/commands/send-mass-emails.py
+++ b/wger/email/management/commands/send-mass-emails.py
@@ -14,10 +14,12 @@
#
# You should have received a copy of the GNU Affero General Public License
-from django.core import mail
+# Third Party
from django.conf import settings
-
+from django.core import mail
from django.core.management.base import BaseCommand
+
+# wger
from wger.email.models import CronEntry
diff --git a/wger/email/models.py b/wger/email/models.py
index 294d34044..751c53e8a 100644
--- a/wger/email/models.py
+++ b/wger/email/models.py
@@ -14,9 +14,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.contrib.auth.models import User
from django.db import models
+# wger
from wger.gym.models import Gym
diff --git a/wger/email/tests/test_gym_emails.py b/wger/email/tests/test_gym_emails.py
index fc7be7e97..eefb06a49 100644
--- a/wger/email/tests/test_gym_emails.py
+++ b/wger/email/tests/test_gym_emails.py
@@ -12,11 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.urlresolvers import reverse
-from wger.core.tests.base_testcase import (
- WorkoutManagerAccessTestCase,
-)
+# wger
+from wger.core.tests.base_testcase import WorkoutManagerAccessTestCase
class AccessContractTestCase(WorkoutManagerAccessTestCase):
diff --git a/wger/email/urls.py b/wger/email/urls.py
index d3288bbde..194eee117 100644
--- a/wger/email/urls.py
+++ b/wger/email/urls.py
@@ -14,8 +14,13 @@
#
# You should have received a copy of the GNU Affero General Public License
-from django.conf.urls import url, include
+# Third Party
+from django.conf.urls import (
+ include,
+ url
+)
+# wger
from wger.email.forms import EmailListForm
from wger.email.views import gym
diff --git a/wger/email/views/gym.py b/wger/email/views/gym.py
index cd65321d3..96fba8f47 100644
--- a/wger/email/views/gym.py
+++ b/wger/email/views/gym.py
@@ -14,18 +14,25 @@
#
# You should have received a copy of the GNU Affero General Public License
-from django.contrib.auth.mixins import PermissionRequiredMixin
+# Third Party
from django.conf import settings
-from django.http import HttpResponseRedirect, HttpResponseForbidden
+from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core import mail
from django.core.urlresolvers import reverse
+from django.http import (
+ HttpResponseForbidden,
+ HttpResponseRedirect
+)
from django.shortcuts import get_object_or_404
from django.views import generic
-
from formtools.preview import FormPreview
+# wger
+from wger.email.models import (
+ CronEntry,
+ Log
+)
from wger.gym.models import Gym
-from wger.email.models import CronEntry, Log
class EmailLogListView(PermissionRequiredMixin, generic.ListView):
diff --git a/wger/exercises/admin.py b/wger/exercises/admin.py
index 02e41b9eb..65a4b24cd 100644
--- a/wger/exercises/admin.py
+++ b/wger/exercises/admin.py
@@ -12,13 +12,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.contrib import admin
-from wger.core.models import Language
-from wger.exercises.models import Exercise
-from wger.exercises.models import ExerciseComment
-from wger.exercises.models import ExerciseCategory
-from wger.exercises.models import Muscle
+# wger
+from wger.core.models import Language
+from wger.exercises.models import (
+ Exercise,
+ ExerciseCategory,
+ ExerciseComment,
+ Muscle
+)
class ExerciseCommentInline(admin.TabularInline): # admin.StackedInline
diff --git a/wger/exercises/api/resources.py b/wger/exercises/api/resources.py
index c8f3efac9..27e41283c 100644
--- a/wger/exercises/api/resources.py
+++ b/wger/exercises/api/resources.py
@@ -14,21 +14,28 @@
#
# You should have received a copy of the GNU Affero General Public License
-from tastypie import fields
-from tastypie.resources import ModelResource
-from tastypie.constants import ALL, ALL_WITH_RELATIONS
+# Third Party
from easy_thumbnails.alias import aliases
from easy_thumbnails.files import get_thumbnailer
+from tastypie import fields
+from tastypie.constants import (
+ ALL,
+ ALL_WITH_RELATIONS
+)
+from tastypie.resources import ModelResource
-from wger.core.api.resources import LanguageResource, LicenseResource
-
+# wger
+from wger.core.api.resources import (
+ LanguageResource,
+ LicenseResource
+)
from wger.exercises.models import (
+ Equipment,
Exercise,
ExerciseCategory,
ExerciseComment,
ExerciseImage,
- Muscle,
- Equipment
+ Muscle
)
diff --git a/wger/exercises/api/serializers.py b/wger/exercises/api/serializers.py
index 6f6766828..94eeedf8b 100644
--- a/wger/exercises/api/serializers.py
+++ b/wger/exercises/api/serializers.py
@@ -14,14 +14,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from rest_framework import serializers
+
+# wger
from wger.exercises.models import (
- Muscle,
+ Equipment,
Exercise,
- ExerciseImage,
ExerciseCategory,
- Equipment,
- ExerciseComment
+ ExerciseComment,
+ ExerciseImage,
+ Muscle
)
diff --git a/wger/exercises/api/views.py b/wger/exercises/api/views.py
index 908c5d93d..4ccc2022b 100644
--- a/wger/exercises/api/views.py
+++ b/wger/exercises/api/views.py
@@ -15,35 +15,41 @@
# 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/>.
+# Third Party
+from django.utils.translation import ugettext as _
+from easy_thumbnails.alias import aliases
+from easy_thumbnails.files import get_thumbnailer
from rest_framework import viewsets
+from rest_framework.decorators import (
+ api_view,
+ detail_route
+)
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from rest_framework.response import Response
-from rest_framework.decorators import detail_route, api_view
-
-from easy_thumbnails.alias import aliases
-from easy_thumbnails.files import get_thumbnailer
-
-from django.utils.translation import ugettext as _
+# wger
from wger.config.models import LanguageConfig
from wger.exercises.api.serializers import (
- MuscleSerializer,
- ExerciseSerializer,
- ExerciseImageSerializer,
+ EquipmentSerializer,
ExerciseCategorySerializer,
+ ExerciseCommentSerializer,
+ ExerciseImageSerializer,
ExerciseInfoSerializer,
- EquipmentSerializer,
- ExerciseCommentSerializer
+ ExerciseSerializer,
+ MuscleSerializer
)
from wger.exercises.models import (
- Exercise,
Equipment,
+ Exercise,
ExerciseCategory,
- ExerciseImage,
ExerciseComment,
+ ExerciseImage,
Muscle
)
-from wger.utils.language import load_item_languages, load_language
+from wger.utils.language import (
+ load_item_languages,
+ load_language
+)
from wger.utils.permissions import CreateOnlyPermission
diff --git a/wger/exercises/apps.py b/wger/exercises/apps.py
index 64f00e5ee..bd2ef6da7 100644
--- a/wger/exercises/apps.py
+++ b/wger/exercises/apps.py
@@ -14,6 +14,7 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.apps import AppConfig
diff --git a/wger/exercises/forms.py b/wger/exercises/forms.py
index 1c883941d..4229856dd 100644
--- a/wger/exercises/forms.py
+++ b/wger/exercises/forms.py
@@ -14,9 +14,14 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django import forms
-from wger.exercises.models import ExerciseImage, ExerciseComment
+# wger
+from wger.exercises.models import (
+ ExerciseComment,
+ ExerciseImage
+)
class ExerciseImageForm(forms.ModelForm):
diff --git a/wger/exercises/management/commands/download-exercise-images.py b/wger/exercises/management/commands/download-exercise-images.py
index 472ba165e..06aaaae40 100644
--- a/wger/exercises/management/commands/download-exercise-images.py
+++ b/wger/exercises/management/commands/download-exercise-images.py
@@ -14,20 +14,31 @@
#
# You should have received a copy of the GNU Affero General Public License
-import requests
+# Standard Library
import os
-from wger import get_version
-from requests.utils import default_user_agent
-from django.core.exceptions import ImproperlyConfigured
-from django.core.management.base import BaseCommand, CommandError
+# Third Party
+import requests
+from django.conf import settings
+from django.core.exceptions import (
+ ImproperlyConfigured,
+ ValidationError
+)
from django.core.files import File
from django.core.files.temp import NamedTemporaryFile
+from django.core.management.base import (
+ BaseCommand,
+ CommandError
+)
from django.core.validators import URLValidator
-from django.core.exceptions import ValidationError
-from django.conf import settings
+from requests.utils import default_user_agent
-from wger.exercises.models import Exercise, ExerciseImage
+# wger
+from wger import get_version
+from wger.exercises.models import (
+ Exercise,
+ ExerciseImage
+)
class Command(BaseCommand):
diff --git a/wger/exercises/management/commands/redo-capitalize-names.py b/wger/exercises/management/commands/redo-capitalize-names.py
index b737069fb..8dbdcaa95 100644
--- a/wger/exercises/management/commands/redo-capitalize-names.py
+++ b/wger/exercises/management/commands/redo-capitalize-names.py
@@ -14,8 +14,10 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.management.base import BaseCommand
+# wger
from wger.exercises.models import Exercise
from wger.utils.helpers import smart_capitalize
diff --git a/wger/exercises/management/commands/submitted-exercises.py b/wger/exercises/management/commands/submitted-exercises.py
index 160e28104..480991efb 100644
--- a/wger/exercises/management/commands/submitted-exercises.py
+++ b/wger/exercises/management/commands/submitted-exercises.py
@@ -14,7 +14,10 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.management.base import BaseCommand
+
+# wger
from wger.exercises.models import Exercise
diff --git a/wger/exercises/models.py b/wger/exercises/models.py
index 786464720..20e19021d 100644
--- a/wger/exercises/models.py
+++ b/wger/exercises/models.py
@@ -15,33 +15,39 @@
# 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/>.
-import six
-import uuid
+# Standard Library
import logging
-import bleach
+import uuid
-from django.db import models
-from django.template.loader import render_to_string
-from django.utils.text import slugify
+# Third Party
+import bleach
+import six
+from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
-from django.utils.translation import ugettext_lazy as _
-from django.utils.encoding import python_2_unicode_compatible
-from django.utils import translation
-from django.core.urlresolvers import reverse
from django.core import mail
from django.core.cache import cache
+from django.core.urlresolvers import reverse
from django.core.validators import MinLengthValidator
-from django.conf import settings
+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 _
+# wger
from wger.core.models import Language
-from wger.utils.helpers import smart_capitalize
-from wger.utils.managers import SubmissionManager
-from wger.utils.models import AbstractLicenseModel, AbstractSubmissionModel
from wger.utils.cache import (
+ cache_mapper,
delete_template_fragment_cache,
- reset_workout_canonical_form,
- cache_mapper
+ reset_workout_canonical_form
+)
+from wger.utils.helpers import smart_capitalize
+from wger.utils.managers import SubmissionManager
+from wger.utils.models import (
+ AbstractLicenseModel,
+ AbstractSubmissionModel
)
diff --git a/wger/exercises/signals.py b/wger/exercises/signals.py
index 80a4660b1..3c0d13ce3 100644
--- a/wger/exercises/signals.py
+++ b/wger/exercises/signals.py
@@ -15,13 +15,17 @@
# You should have received a copy of the GNU Affero General Public License
-from django.db.models.signals import pre_save
-from django.db.models.signals import post_delete
+# Third Party
+from django.db.models.signals import (
+ post_delete,
+ pre_save
+)
from django.dispatch import receiver
from easy_thumbnails.files import get_thumbnailer
from easy_thumbnails.signal_handlers import generate_aliases
from easy_thumbnails.signals import saved_file
+# wger
from wger.exercises.models import ExerciseImage
diff --git a/wger/exercises/sitemap.py b/wger/exercises/sitemap.py
index d86ed4e3b..a09e4a3d1 100644
--- a/wger/exercises/sitemap.py
+++ b/wger/exercises/sitemap.py
@@ -14,10 +14,13 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.contrib.sitemaps import Sitemap
+
+# wger
+from wger.config.models import LanguageConfig
from wger.exercises.models import Exercise
from wger.utils.language import load_item_languages
-from wger.config.models import LanguageConfig
class ExercisesSitemap(Sitemap):
diff --git a/wger/exercises/tests/test_categories.py b/wger/exercises/tests/test_categories.py
index ac8d3fb89..6d9b0bde3 100644
--- a/wger/exercises/tests/test_categories.py
+++ b/wger/exercises/tests/test_categories.py
@@ -12,16 +12,19 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.cache import cache
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests import api_base_test
from wger.core.tests.base_testcase import (
+ WorkoutManagerAccessTestCase,
+ WorkoutManagerAddTestCase,
WorkoutManagerDeleteTestCase,
- WorkoutManagerTestCase,
WorkoutManagerEditTestCase,
- WorkoutManagerAddTestCase,
- WorkoutManagerAccessTestCase)
+ WorkoutManagerTestCase
+)
from wger.exercises.models import ExerciseCategory
from wger.utils.cache import get_template_cache_name
diff --git a/wger/exercises/tests/test_corrected_exercise.py b/wger/exercises/tests/test_corrected_exercise.py
index 1232e7a53..7076f9b34 100644
--- a/wger/exercises/tests/test_corrected_exercise.py
+++ b/wger/exercises/tests/test_corrected_exercise.py
@@ -12,9 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core import mail
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.exercises.models import Exercise
diff --git a/wger/exercises/tests/test_equipment.py b/wger/exercises/tests/test_equipment.py
index 7fa43725f..400a195c7 100644
--- a/wger/exercises/tests/test_equipment.py
+++ b/wger/exercises/tests/test_equipment.py
@@ -13,17 +13,22 @@
# 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/>.
+# Third Party
from django.core.cache import cache
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests import api_base_test
from wger.core.tests.base_testcase import (
- WorkoutManagerTestCase,
+ WorkoutManagerAddTestCase,
WorkoutManagerDeleteTestCase,
WorkoutManagerEditTestCase,
- WorkoutManagerAddTestCase
+ WorkoutManagerTestCase
+)
+from wger.exercises.models import (
+ Equipment,
+ Exercise
)
-from wger.exercises.models import Equipment, Exercise
from wger.utils.cache import get_template_cache_name
from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGE
diff --git a/wger/exercises/tests/test_exercise.py b/wger/exercises/tests/test_exercise.py
index 225b35e65..f271e2744 100644
--- a/wger/exercises/tests/test_exercise.py
+++ b/wger/exercises/tests/test_exercise.py
@@ -12,23 +12,29 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import json
+# Third Party
from django.core import mail
from django.core.cache import cache
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import (
STATUS_CODES_FAIL,
- WorkoutManagerTestCase,
- WorkoutManagerDeleteTestCase
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerTestCase
)
from wger.exercises.models import (
Exercise,
- Muscle,
ExerciseCategory,
+ Muscle
+)
+from wger.utils.cache import (
+ cache_mapper,
+ get_template_cache_name
)
-from wger.utils.cache import get_template_cache_name, cache_mapper
class ExerciseRepresentationTestCase(WorkoutManagerTestCase):
diff --git a/wger/exercises/tests/test_exercise_comments.py b/wger/exercises/tests/test_exercise_comments.py
index 86385d18c..1bbedeb16 100644
--- a/wger/exercises/tests/test_exercise_comments.py
+++ b/wger/exercises/tests/test_exercise_comments.py
@@ -13,16 +13,21 @@
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.cache import cache
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests import api_base_test
from wger.core.tests.base_testcase import (
- WorkoutManagerTestCase,
+ WorkoutManagerAddTestCase,
WorkoutManagerEditTestCase,
- WorkoutManagerAddTestCase
+ WorkoutManagerTestCase
+)
+from wger.exercises.models import (
+ Exercise,
+ ExerciseComment
)
-from wger.exercises.models import Exercise, ExerciseComment
from wger.utils.cache import cache_mapper
diff --git a/wger/exercises/tests/test_exercise_images.py b/wger/exercises/tests/test_exercise_images.py
index f3db1b416..473d4023c 100644
--- a/wger/exercises/tests/test_exercise_images.py
+++ b/wger/exercises/tests/test_exercise_images.py
@@ -12,16 +12,21 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.files import File
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import (
- WorkoutManagerTestCase,
- WorkoutManagerEditTestCase,
WorkoutManagerAddTestCase,
- WorkoutManagerDeleteTestCase
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
+from wger.exercises.models import (
+ Exercise,
+ ExerciseImage
)
-from wger.exercises.models import Exercise, ExerciseImage
class MainImageTestCase(WorkoutManagerTestCase):
diff --git a/wger/exercises/tests/test_muscles.py b/wger/exercises/tests/test_muscles.py
index 2c2c5a279..ba16b4210 100644
--- a/wger/exercises/tests/test_muscles.py
+++ b/wger/exercises/tests/test_muscles.py
@@ -13,16 +13,19 @@
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.cache import cache
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests import api_base_test
from wger.core.tests.base_testcase import (
- WorkoutManagerTestCase,
+ WorkoutManagerAccessTestCase,
+ WorkoutManagerAddTestCase,
WorkoutManagerDeleteTestCase,
WorkoutManagerEditTestCase,
- WorkoutManagerAddTestCase,
- WorkoutManagerAccessTestCase)
+ WorkoutManagerTestCase
+)
from wger.exercises.models import Muscle
from wger.utils.cache import get_template_cache_name
diff --git a/wger/exercises/tests/test_submitted_exercise.py b/wger/exercises/tests/test_submitted_exercise.py
index f4da317d3..16421723e 100644
--- a/wger/exercises/tests/test_submitted_exercise.py
+++ b/wger/exercises/tests/test_submitted_exercise.py
@@ -12,10 +12,15 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core import mail
from django.core.urlresolvers import reverse
-from wger.core.tests.base_testcase import STATUS_CODES_FAIL, WorkoutManagerTestCase
+# wger
+from wger.core.tests.base_testcase import (
+ STATUS_CODES_FAIL,
+ WorkoutManagerTestCase
+)
from wger.exercises.models import Exercise
diff --git a/wger/exercises/tests/test_submitted_image.py b/wger/exercises/tests/test_submitted_image.py
index 77bef88a0..65f91e4a5 100644
--- a/wger/exercises/tests/test_submitted_image.py
+++ b/wger/exercises/tests/test_submitted_image.py
@@ -12,9 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core import mail
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.exercises.models import ExerciseImage
diff --git a/wger/exercises/urls.py b/wger/exercises/urls.py
index a804913fd..693dd3f5a 100644
--- a/wger/exercises/urls.py
+++ b/wger/exercises/urls.py
@@ -15,16 +15,21 @@
# 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/>.
-from django.conf.urls import url, include
+# Third Party
+from django.conf.urls import (
+ include,
+ url
+)
from django.contrib.auth.decorators import login_required
+# wger
from wger.exercises.views import (
- exercises,
- comments,
categories,
- muscles,
+ comments,
+ equipment,
+ exercises,
images,
- equipment
+ muscles
)
diff --git a/wger/exercises/views/categories.py b/wger/exercises/views/categories.py
index dc669c8ed..936582451 100644
--- a/wger/exercises/views/categories.py
+++ b/wger/exercises/views/categories.py
@@ -13,24 +13,35 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
+# Standard Library
+import logging
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- DeleteView,
CreateView,
- UpdateView,
- ListView)
+ DeleteView,
+ ListView,
+ UpdateView
+)
+# wger
from wger.exercises.models import ExerciseCategory
-
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
from wger.utils.language import load_language
diff --git a/wger/exercises/views/comments.py b/wger/exercises/views/comments.py
index fda581f07..e51dc70d0 100644
--- a/wger/exercises/views/comments.py
+++ b/wger/exercises/views/comments.py
@@ -13,19 +13,31 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Standard Library
import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
-from django.shortcuts import get_object_or_404
-from django.http import HttpResponseRedirect
-from django.core.urlresolvers import reverse
+# Third Party
from django.contrib.auth.decorators import permission_required
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
+from django.core.urlresolvers import reverse
+from django.http import HttpResponseRedirect
+from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext_lazy
+from django.views.generic import (
+ CreateView,
+ UpdateView
+)
-from django.views.generic import CreateView, UpdateView
-
+# wger
from wger.exercises.forms import CommentForm
-from wger.exercises.models import Exercise, ExerciseComment
+from wger.exercises.models import (
+ Exercise,
+ ExerciseComment
+)
from wger.utils.generic_views import WgerFormMixin
diff --git a/wger/exercises/views/equipment.py b/wger/exercises/views/equipment.py
index a7f13fa71..6d5c62c7c 100644
--- a/wger/exercises/views/equipment.py
+++ b/wger/exercises/views/equipment.py
@@ -13,26 +13,38 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.utils.translation import ugettext_lazy
-from django.utils.translation import ugettext as _
+# Standard Library
+import logging
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
CreateView,
- UpdateView,
DeleteView,
- ListView
+ ListView,
+ UpdateView
)
+
+# wger
from wger.config.models import LanguageConfig
from wger.exercises.models import Equipment
+from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGE
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
-from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGE
from wger.utils.language import load_item_languages
diff --git a/wger/exercises/views/exercises.py b/wger/exercises/views/exercises.py
index 4c5a7280d..cc7977b81 100644
--- a/wger/exercises/views/exercises.py
+++ b/wger/exercises/views/exercises.py
@@ -9,55 +9,77 @@
#
# wger Workout Manager is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
+
+
+# Standard Library
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
+import logging
+import uuid
+
+# Third Party
#
# You should have received a copy of the GNU Affero General Public License
import six
-import logging
-import uuid
+from django.contrib import messages
+from django.contrib.auth.decorators import permission_required
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.core import mail
-
-from django.shortcuts import render, get_object_or_404
-from django.http import HttpResponseRedirect, HttpResponseForbidden
+from django.core.cache import cache
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
from django.forms import (
- ModelForm,
ModelChoiceField,
+ ModelForm,
ModelMultipleChoiceField
)
-from django.core.cache import cache
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
-from django.contrib.auth.decorators import permission_required
-from django.contrib import messages
+from django.http import (
+ HttpResponseForbidden,
+ HttpResponseRedirect
+)
+from django.shortcuts import (
+ get_object_or_404,
+ render
+)
from django.template.loader import render_to_string
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- ListView,
- DeleteView,
CreateView,
+ DeleteView,
+ ListView,
UpdateView
)
-from wger.manager.models import WorkoutLog
+# wger
+from wger.config.models import LanguageConfig
from wger.exercises.models import (
Exercise,
- Muscle,
- ExerciseCategory
+ ExerciseCategory,
+ Muscle
)
+from wger.manager.models import WorkoutLog
+from wger.utils.cache import cache_mapper
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
+)
+from wger.utils.language import (
+ load_item_languages,
+ load_language
)
-from wger.utils.language import load_language, load_item_languages
-from wger.utils.cache import cache_mapper
from wger.utils.widgets import (
+ TranslatedOriginalSelectMultiple,
TranslatedSelect,
- TranslatedSelectMultiple,
- TranslatedOriginalSelectMultiple
+ TranslatedSelectMultiple
)
-from wger.config.models import LanguageConfig
from wger.weight.helpers import process_log_entries
diff --git a/wger/exercises/views/images.py b/wger/exercises/views/images.py
index a64e8dbee..ef88e6181 100644
--- a/wger/exercises/views/images.py
+++ b/wger/exercises/views/images.py
@@ -13,26 +13,38 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Standard Library
import logging
+# Third Party
from django.contrib.auth.decorators import permission_required
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
-from django.utils.translation import ugettext_lazy
-from django.utils.translation import ugettext as _
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
CreateView,
- UpdateView,
- DeleteView
+ DeleteView,
+ UpdateView
)
-from wger.exercises.models import Exercise, ExerciseImage
+# wger
from wger.exercises.forms import ExerciseImageForm
+from wger.exercises.models import (
+ Exercise,
+ ExerciseImage
+)
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
diff --git a/wger/exercises/views/muscles.py b/wger/exercises/views/muscles.py
index b73c874a0..c32f481d4 100644
--- a/wger/exercises/views/muscles.py
+++ b/wger/exercises/views/muscles.py
@@ -13,27 +13,39 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
+# Standard Library
+import logging
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- ListView,
- DeleteView,
CreateView,
+ DeleteView,
+ ListView,
UpdateView
)
+# wger
+from wger.config.models import LanguageConfig
from wger.exercises.models import Muscle
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
from wger.utils.language import load_item_languages
-from wger.config.models import LanguageConfig
+
logger = logging.getLogger(__name__)
diff --git a/wger/gym/apps.py b/wger/gym/apps.py
index 3804b4f1a..705c949cb 100644
--- a/wger/gym/apps.py
+++ b/wger/gym/apps.py
@@ -14,6 +14,7 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.apps import AppConfig
diff --git a/wger/gym/forms.py b/wger/gym/forms.py
index 0c0ebcb70..7a1d6c1d2 100644
--- a/wger/gym/forms.py
+++ b/wger/gym/forms.py
@@ -14,10 +14,12 @@
#
# You should have received a copy of the GNU Affero General Public License
-from django.contrib.auth.models import User
+# Third Party
from django import forms
+from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
+# wger
from wger.core.forms import UserPersonalInformationForm
from wger.utils.widgets import BootstrapSelectMultiple
diff --git a/wger/gym/helpers.py b/wger/gym/helpers.py
index c55b5922c..896e25a48 100644
--- a/wger/gym/helpers.py
+++ b/wger/gym/helpers.py
@@ -14,7 +14,11 @@
#
# You should have received a copy of the GNU Affero General Public License
-from wger.manager.models import WorkoutLog, WorkoutSession
+# wger
+from wger.manager.models import (
+ WorkoutLog,
+ WorkoutSession
+)
def get_user_last_activity(user):
diff --git a/wger/gym/management/commands/gym-user-config.py b/wger/gym/management/commands/gym-user-config.py
index e6d64cf25..2af1ddbd9 100644
--- a/wger/gym/management/commands/gym-user-config.py
+++ b/wger/gym/management/commands/gym-user-config.py
@@ -14,12 +14,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
+# wger
from wger.gym.helpers import is_any_gym_admin
-from wger.gym.models import GymUserConfig, GymAdminConfig
+from wger.gym.models import (
+ GymAdminConfig,
+ GymUserConfig
+)
class Command(BaseCommand):
diff --git a/wger/gym/management/commands/inactive-members.py b/wger/gym/management/commands/inactive-members.py
index 7a5110d3d..51898bab8 100644
--- a/wger/gym/management/commands/inactive-members.py
+++ b/wger/gym/management/commands/inactive-members.py
@@ -14,15 +14,18 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
+# Third Party
+from django.conf import settings
from django.core import mail
-from django.utils import translation
-from django.utils.translation import ugettext as _
from django.core.management.base import BaseCommand
from django.template.loader import render_to_string
-from django.conf import settings
+from django.utils import translation
+from django.utils.translation import ugettext as _
+# wger
from wger.gym.helpers import is_any_gym_admin
from wger.gym.models import Gym
diff --git a/wger/gym/managers.py b/wger/gym/managers.py
index 09460f1dc..f531b3082 100644
--- a/wger/gym/managers.py
+++ b/wger/gym/managers.py
@@ -14,12 +14,13 @@
#
# You should have received a copy of the GNU Affero General Public License
-from django.db import models
-from django.db.models import Q
+# Third Party
from django.contrib.auth.models import (
Permission,
User
)
+from django.db import models
+from django.db.models import Q
class GymManager(models.Manager):
diff --git a/wger/gym/models.py b/wger/gym/models.py
index a5f7ab94e..9c728a75a 100644
--- a/wger/gym/models.py
+++ b/wger/gym/models.py
@@ -14,16 +14,21 @@
#
# You should have received a copy of the GNU Affero General Public License
-import uuid
+# Standard Library
import datetime
+import uuid
-from django.db import models as m
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+from django.db import models as m
from django.utils.encoding import python_2_unicode_compatible
-from django.utils.translation import ugettext_lazy as _
-from django.utils.translation import ugettext
+from django.utils.translation import (
+ ugettext,
+ ugettext_lazy as _
+)
+# wger
from wger.gym.managers import GymManager
diff --git a/wger/gym/signals.py b/wger/gym/signals.py
index c279569a3..c51dbb30c 100644
--- a/wger/gym/signals.py
+++ b/wger/gym/signals.py
@@ -15,9 +15,14 @@
# You should have received a copy of the GNU Affero General Public License
-from django.db.models.signals import post_save, post_delete
+# Third Party
+from django.db.models.signals import (
+ post_delete,
+ post_save
+)
from django.dispatch import receiver
+# wger
from wger.gym.models import (
Gym,
GymConfig,
diff --git a/wger/gym/tests/test_admin_config.py b/wger/gym/tests/test_admin_config.py
index a05f17570..624d88843 100644
--- a/wger/gym/tests/test_admin_config.py
+++ b/wger/gym/tests/test_admin_config.py
@@ -12,8 +12,8 @@
#
# You should have received a copy of the GNU Affero General Public License
+# wger
from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-
from wger.gym.models import GymAdminConfig
diff --git a/wger/gym/tests/test_admin_user_notes.py b/wger/gym/tests/test_admin_user_notes.py
index 147859166..9979f1b75 100644
--- a/wger/gym/tests/test_admin_user_notes.py
+++ b/wger/gym/tests/test_admin_user_notes.py
@@ -12,13 +12,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.urlresolvers import reverse_lazy
-from wger.core.tests.base_testcase import WorkoutManagerAccessTestCase
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-from wger.core.tests.base_testcase import delete_testcase_add_methods
+# wger
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAccessTestCase,
+ WorkoutManagerAddTestCase,
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ delete_testcase_add_methods
+)
from wger.gym.models import AdminUserNote
diff --git a/wger/gym/tests/test_config.py b/wger/gym/tests/test_config.py
index ab1b7ea80..8be29fbf5 100644
--- a/wger/gym/tests/test_config.py
+++ b/wger/gym/tests/test_config.py
@@ -13,6 +13,7 @@
# 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.tests.base_testcase import WorkoutManagerEditTestCase
from wger.gym.models import GymConfig
diff --git a/wger/gym/tests/test_contract_options.py b/wger/gym/tests/test_contract_options.py
index eea8350fc..5df314e9a 100644
--- a/wger/gym/tests/test_contract_options.py
+++ b/wger/gym/tests/test_contract_options.py
@@ -12,14 +12,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import (
- WorkoutManagerEditTestCase,
+ WorkoutManagerAccessTestCase,
WorkoutManagerAddTestCase,
WorkoutManagerDeleteTestCase,
- WorkoutManagerAccessTestCase,
- delete_testcase_add_methods)
+ WorkoutManagerEditTestCase,
+ delete_testcase_add_methods
+)
from wger.gym.models import ContractOption
diff --git a/wger/gym/tests/test_contract_types.py b/wger/gym/tests/test_contract_types.py
index 17cef7dda..471fd9c93 100644
--- a/wger/gym/tests/test_contract_types.py
+++ b/wger/gym/tests/test_contract_types.py
@@ -12,14 +12,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import (
- WorkoutManagerEditTestCase,
+ WorkoutManagerAccessTestCase,
WorkoutManagerAddTestCase,
WorkoutManagerDeleteTestCase,
- WorkoutManagerAccessTestCase,
- delete_testcase_add_methods)
+ WorkoutManagerEditTestCase,
+ delete_testcase_add_methods
+)
from wger.gym.models import ContractType
diff --git a/wger/gym/tests/test_contracts.py b/wger/gym/tests/test_contracts.py
index 3ecaf7464..6d0a75619 100644
--- a/wger/gym/tests/test_contracts.py
+++ b/wger/gym/tests/test_contracts.py
@@ -12,12 +12,14 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import (
WorkoutManagerAccessTestCase,
- WorkoutManagerEditTestCase,
WorkoutManagerAddTestCase,
+ WorkoutManagerEditTestCase
)
from wger.gym.models import Contract
diff --git a/wger/gym/tests/test_export.py b/wger/gym/tests/test_export.py
index e9e755c6f..6cc4ab675 100644
--- a/wger/gym/tests/test_export.py
+++ b/wger/gym/tests/test_export.py
@@ -12,10 +12,13 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.gym.models import Gym
diff --git a/wger/gym/tests/test_gym.py b/wger/gym/tests/test_gym.py
index d07671cb6..ebf79475b 100644
--- a/wger/gym/tests/test_gym.py
+++ b/wger/gym/tests/test_gym.py
@@ -12,15 +12,20 @@
#
# 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/>.
+
+# Third Party
from django.core.urlresolvers import reverse_lazy
+# wger
from wger.core.models import UserProfile
-from wger.core.tests.base_testcase import WorkoutManagerAccessTestCase
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-from wger.core.tests.base_testcase import WorkoutManagerTestCase
-from wger.core.tests.base_testcase import delete_testcase_add_methods
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAccessTestCase,
+ WorkoutManagerAddTestCase,
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase,
+ delete_testcase_add_methods
+)
from wger.gym.models import Gym
diff --git a/wger/gym/tests/test_inactive_members.py b/wger/gym/tests/test_inactive_members.py
index 07867cd8d..c40212aac 100644
--- a/wger/gym/tests/test_inactive_members.py
+++ b/wger/gym/tests/test_inactive_members.py
@@ -12,9 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core import mail
from django.core.management import call_command
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
diff --git a/wger/gym/tests/test_user.py b/wger/gym/tests/test_user.py
index 1157600b9..c2ca17a37 100644
--- a/wger/gym/tests/test_user.py
+++ b/wger/gym/tests/test_user.py
@@ -12,17 +12,24 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
-from django.contrib.auth.models import Permission
-from django.contrib.auth.models import User
+# Third Party
+from django.contrib.auth.models import (
+ Permission,
+ User
+)
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
+# wger
from wger.core.models import UserProfile
from wger.core.tests.base_testcase import WorkoutManagerTestCase
-from wger.gym.models import Gym
-from wger.gym.models import GymAdminConfig
+from wger.gym.models import (
+ Gym,
+ GymAdminConfig
+)
class GymAddUserTestCase(WorkoutManagerTestCase):
diff --git a/wger/gym/tests/test_user_config.py b/wger/gym/tests/test_user_config.py
index 347a059c2..86bb00552 100644
--- a/wger/gym/tests/test_user_config.py
+++ b/wger/gym/tests/test_user_config.py
@@ -12,8 +12,8 @@
#
# You should have received a copy of the GNU Affero General Public License
+# wger
from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-
from wger.gym.models import GymUserConfig
diff --git a/wger/gym/tests/test_user_documents.py b/wger/gym/tests/test_user_documents.py
index 778740cb6..8461847b5 100644
--- a/wger/gym/tests/test_user_documents.py
+++ b/wger/gym/tests/test_user_documents.py
@@ -12,12 +12,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.urlresolvers import reverse
-from wger.core.tests.base_testcase import WorkoutManagerAccessTestCase, delete_testcase_add_methods
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
+# wger
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAccessTestCase,
+ WorkoutManagerAddTestCase,
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ delete_testcase_add_methods
+)
from wger.gym.models import UserDocument
diff --git a/wger/gym/tests/test_user_last_activity.py b/wger/gym/tests/test_user_last_activity.py
index 69a06919b..4bcf1e058 100644
--- a/wger/gym/tests/test_user_last_activity.py
+++ b/wger/gym/tests/test_user_last_activity.py
@@ -12,13 +12,19 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
+# Third Party
from django.contrib.auth.models import User
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.gym.helpers import get_user_last_activity
-from wger.manager.models import WorkoutSession, WorkoutLog
+from wger.manager.models import (
+ WorkoutLog,
+ WorkoutSession
+)
class UserLastActivityTestCase(WorkoutManagerTestCase):
diff --git a/wger/gym/urls.py b/wger/gym/urls.py
index 38c439445..035ea3607 100644
--- a/wger/gym/urls.py
+++ b/wger/gym/urls.py
@@ -15,22 +15,24 @@
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.conf.urls import (
- url,
- include
+ include,
+ url
)
+# wger
from wger.gym.views import (
- gym,
- config,
admin_config,
- user_config,
admin_notes,
- document,
+ config,
contract,
- contract_type,
contract_option,
- export
+ contract_type,
+ document,
+ export,
+ gym,
+ user_config
)
diff --git a/wger/gym/views/admin_config.py b/wger/gym/views/admin_config.py
index a9010bc16..7c8d91d97 100644
--- a/wger/gym/views/admin_config.py
+++ b/wger/gym/views/admin_config.py
@@ -14,12 +14,15 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.views.generic import UpdateView
+# wger
from wger.gym.models import GymAdminConfig
from wger.utils.generic_views import WgerFormMixin
diff --git a/wger/gym/views/admin_notes.py b/wger/gym/views/admin_notes.py
index e6b3d4001..37649f081 100644
--- a/wger/gym/views/admin_notes.py
+++ b/wger/gym/views/admin_notes.py
@@ -13,25 +13,34 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Standard Library
import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
-from django.core.urlresolvers import reverse
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.contrib.auth.models import User
+from django.core.urlresolvers import reverse
from django.http.response import HttpResponseForbidden
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- ListView,
- DeleteView,
CreateView,
+ DeleteView,
+ ListView,
UpdateView
)
+# wger
from wger.gym.models import AdminUserNote
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
diff --git a/wger/gym/views/config.py b/wger/gym/views/config.py
index 3e9cf6f91..3244200cd 100644
--- a/wger/gym/views/config.py
+++ b/wger/gym/views/config.py
@@ -13,14 +13,21 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Standard Library
import logging
-from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.core.urlresolvers import reverse
from django.http.response import HttpResponseForbidden
from django.utils.translation import ugettext as _
from django.views.generic import UpdateView
+# wger
from wger.gym.models import GymConfig
from wger.utils.generic_views import WgerFormMixin
diff --git a/wger/gym/views/contract.py b/wger/gym/views/contract.py
index 6c72e25a8..b0f677eb6 100644
--- a/wger/gym/views/contract.py
+++ b/wger/gym/views/contract.py
@@ -14,24 +14,33 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.core.urlresolvers import reverse
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.contrib.auth.models import User
+from django.core.urlresolvers import reverse
from django.http.response import HttpResponseForbidden
from django.shortcuts import get_object_or_404
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
+ CreateView,
DetailView,
ListView,
- CreateView,
UpdateView
)
-from wger.utils.generic_views import WgerFormMixin
+# wger
from wger.gym.models import Contract
+from wger.utils.generic_views import WgerFormMixin
+
logger = logging.getLogger(__name__)
diff --git a/wger/gym/views/contract_option.py b/wger/gym/views/contract_option.py
index f4e944618..5398e8c9e 100644
--- a/wger/gym/views/contract_option.py
+++ b/wger/gym/views/contract_option.py
@@ -14,24 +14,38 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.core.urlresolvers import reverse
from django.http.response import HttpResponseForbidden
from django.shortcuts import get_object_or_404
-from django.utils.translation import ugettext_lazy, ugettext as _
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
CreateView,
- UpdateView,
DeleteView,
- ListView)
+ ListView,
+ UpdateView
+)
+# wger
+from wger.gym.models import (
+ ContractOption,
+ Gym
+)
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
-from wger.gym.models import ContractOption, Gym
+
logger = logging.getLogger(__name__)
diff --git a/wger/gym/views/contract_type.py b/wger/gym/views/contract_type.py
index a3fd7cdad..8f9e69738 100644
--- a/wger/gym/views/contract_type.py
+++ b/wger/gym/views/contract_type.py
@@ -14,24 +14,38 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.core.urlresolvers import reverse
from django.http.response import HttpResponseForbidden
from django.shortcuts import get_object_or_404
-from django.utils.translation import ugettext_lazy, ugettext as _
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
CreateView,
- UpdateView,
DeleteView,
- ListView)
+ ListView,
+ UpdateView
+)
+# wger
+from wger.gym.models import (
+ ContractType,
+ Gym
+)
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
-from wger.gym.models import ContractType, Gym
+
logger = logging.getLogger(__name__)
diff --git a/wger/gym/views/document.py b/wger/gym/views/document.py
index fb10b1f76..288eebfa4 100644
--- a/wger/gym/views/document.py
+++ b/wger/gym/views/document.py
@@ -13,26 +13,35 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Standard Library
import logging
-from django.core.urlresolvers import reverse
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.contrib.auth.models import User
+from django.core.urlresolvers import reverse
from django.http.response import HttpResponseForbidden
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- ListView,
- DeleteView,
CreateView,
+ DeleteView,
+ ListView,
UpdateView
)
+# wger
+from wger.gym.models import UserDocument
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
-from wger.gym.models import UserDocument
logger = logging.getLogger(__name__)
diff --git a/wger/gym/views/export.py b/wger/gym/views/export.py
index 010c40ded..cbe1c7a76 100644
--- a/wger/gym/views/export.py
+++ b/wger/gym/views/export.py
@@ -14,20 +14,24 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import csv
import datetime
import logging
+# Third Party
from django.contrib.auth.decorators import login_required
from django.http.response import (
- HttpResponseForbidden,
- HttpResponse
+ HttpResponse,
+ HttpResponseForbidden
)
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext as _
+# wger
from wger.gym.models import Gym
+
logger = logging.getLogger(__name__)
diff --git a/wger/gym/views/gym.py b/wger/gym/views/gym.py
index 3f8facc96..2db730807 100644
--- a/wger/gym/views/gym.py
+++ b/wger/gym/views/gym.py
@@ -9,51 +9,71 @@
#
# 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.
+
+
+# Standard Library
#
# You should have received a copy of the GNU Affero General Public License
import csv
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
import datetime
import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
+# Third Party
from django.contrib.auth.decorators import login_required
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.contrib.auth.models import (
Group,
User
)
-from django.core.urlresolvers import reverse, reverse_lazy
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
from django.http.response import (
- HttpResponseForbidden,
HttpResponse,
+ HttpResponseForbidden,
HttpResponseRedirect
)
-from django.shortcuts import render, get_object_or_404
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
+from django.shortcuts import (
+ get_object_or_404,
+ render
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- ListView,
- DeleteView,
CreateView,
+ DeleteView,
+ ListView,
UpdateView
)
-from wger.gym.forms import GymUserAddForm, GymUserPermisssionForm
+# wger
+from wger.config.models import GymConfig as GlobalGymConfig
+from wger.gym.forms import (
+ GymUserAddForm,
+ GymUserPermisssionForm
+)
from wger.gym.helpers import (
- is_any_gym_admin,
- get_permission_list
+ get_permission_list,
+ is_any_gym_admin
)
from wger.gym.models import (
Gym,
GymAdminConfig,
GymUserConfig
)
-from wger.config.models import GymConfig as GlobalGymConfig
from wger.utils.generic_views import (
- WgerFormMixin,
WgerDeleteMixin,
- WgerMultiplePermissionRequiredMixin)
+ WgerFormMixin,
+ WgerMultiplePermissionRequiredMixin
+)
from wger.utils.helpers import password_generator
diff --git a/wger/gym/views/user_config.py b/wger/gym/views/user_config.py
index 33f710344..0153754d6 100644
--- a/wger/gym/views/user_config.py
+++ b/wger/gym/views/user_config.py
@@ -13,14 +13,21 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Standard Library
import logging
-from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.core.urlresolvers import reverse
from django.http import HttpResponseForbidden
from django.utils.translation import ugettext as _
from django.views.generic import UpdateView
+# wger
from wger.gym.models import GymUserConfig
from wger.utils.generic_views import WgerFormMixin
diff --git a/wger/manager/admin.py b/wger/manager/admin.py
index 99fa13b5f..8b6065b10 100644
--- a/wger/manager/admin.py
+++ b/wger/manager/admin.py
@@ -12,11 +12,14 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-from wger.core.models import UserProfile
+# Third Party
+from django.contrib import admin
+
+# wger
+from wger.core.models import UserProfile
from wger.manager import models as manager_models
-from django.contrib import admin
admin.site.register(manager_models.Workout)
admin.site.register(manager_models.Set)
diff --git a/wger/manager/api/resources.py b/wger/manager/api/resources.py
index d7df00a07..d3336a9f0 100644
--- a/wger/manager/api/resources.py
+++ b/wger/manager/api/resources.py
@@ -14,28 +14,33 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from tastypie import fields
from tastypie.authentication import (
ApiKeyAuthentication,
MultiAuthentication,
SessionAuthentication
)
+from tastypie.constants import (
+ ALL,
+ ALL_WITH_RELATIONS
+)
from tastypie.resources import ModelResource
-from tastypie.constants import ALL, ALL_WITH_RELATIONS
+# wger
from wger.core.api.resources import DaysOfWeekResource
from wger.exercises.api.resources import ExerciseResource
-from wger.utils.resources import UserObjectsOnlyAuthorization
from wger.manager.models import (
- WorkoutSession,
- Workout,
+ Day,
Schedule,
ScheduleStep,
- Day,
Set,
Setting,
- WorkoutLog
+ Workout,
+ WorkoutLog,
+ WorkoutSession
)
+from wger.utils.resources import UserObjectsOnlyAuthorization
class WorkoutResource(ModelResource):
diff --git a/wger/manager/api/serializers.py b/wger/manager/api/serializers.py
index 440a0bae3..7a1058623 100644
--- a/wger/manager/api/serializers.py
+++ b/wger/manager/api/serializers.py
@@ -15,22 +15,23 @@
# 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/>.
+# Third Party
from rest_framework import serializers
+# wger
from wger.core.api.serializers import (
DaysOfWeekSerializer,
RepetitionUnitSerializer,
WeightUnitSerializer
)
from wger.exercises.api.serializers import ExerciseSerializer
-
from wger.manager.models import (
- Workout,
- ScheduleStep,
Day,
- Setting,
- Set,
Schedule,
+ ScheduleStep,
+ Set,
+ Setting,
+ Workout,
WorkoutLog,
WorkoutSession
)
diff --git a/wger/manager/api/views.py b/wger/manager/api/views.py
index 77965e51c..5c9bb97e9 100644
--- a/wger/manager/api/views.py
+++ b/wger/manager/api/views.py
@@ -15,30 +15,33 @@
# 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/>.
+# Standard Library
import datetime
+# Third Party
from rest_framework import viewsets
-from rest_framework.response import Response
from rest_framework.decorators import detail_route
+from rest_framework.response import Response
+# wger
from wger.manager.api.serializers import (
- WorkoutSerializer,
- ScheduleStepSerializer,
- WorkoutCanonicalFormSerializer,
DaySerializer,
- SettingSerializer,
- SetSerializer,
ScheduleSerializer,
+ ScheduleStepSerializer,
+ SetSerializer,
+ SettingSerializer,
+ WorkoutCanonicalFormSerializer,
WorkoutLogSerializer,
+ WorkoutSerializer,
WorkoutSessionSerializer
)
from wger.manager.models import (
- Workout,
- Set,
- ScheduleStep,
- Schedule,
Day,
+ Schedule,
+ ScheduleStep,
+ Set,
Setting,
+ Workout,
WorkoutLog,
WorkoutSession
)
diff --git a/wger/manager/apps.py b/wger/manager/apps.py
index 8c664977b..bebac364f 100644
--- a/wger/manager/apps.py
+++ b/wger/manager/apps.py
@@ -14,6 +14,7 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.apps import AppConfig
diff --git a/wger/manager/forms.py b/wger/manager/forms.py
index c8cc6c61f..3bce31efe 100644
--- a/wger/manager/forms.py
+++ b/wger/manager/forms.py
@@ -18,21 +18,22 @@
This file contains forms used in the application
'''
+# Third Party
from captcha.fields import ReCaptchaField
-
-from django.utils.translation import ugettext as _
from django.forms import (
- Form,
- MultipleHiddenInput,
- ModelForm,
+ CharField,
DateField,
- IntegerField,
DecimalField,
- CharField,
- widgets,
- ModelChoiceField
+ Form,
+ IntegerField,
+ ModelChoiceField,
+ ModelForm,
+ MultipleHiddenInput,
+ widgets
)
+from django.utils.translation import ugettext as _
+# wger
from wger.core.models import (
RepetitionUnit,
WeightUnit
@@ -42,20 +43,20 @@ from wger.exercises.models import (
ExerciseCategory
)
from wger.manager.models import (
- WorkoutSession,
- Workout,
Day,
Set,
Setting,
- WorkoutLog
+ Workout,
+ WorkoutLog,
+ WorkoutSession
)
+from wger.utils.constants import DATE_FORMATS
from wger.utils.widgets import (
- TranslatedSelectMultiple,
+ ExerciseAjaxSelect,
+ Html5DateInput,
TranslatedSelect,
- ExerciseAjaxSelect
+ TranslatedSelectMultiple
)
-from wger.utils.constants import DATE_FORMATS
-from wger.utils.widgets import Html5DateInput
class DemoUserForm(Form):
diff --git a/wger/manager/helpers.py b/wger/manager/helpers.py
index 58343c0ba..72b52d797 100644
--- a/wger/manager/helpers.py
+++ b/wger/manager/helpers.py
@@ -15,24 +15,26 @@
# 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/>.
+# Standard Library
import datetime
from calendar import HTMLCalendar
+# Third Party
+from django.core.urlresolvers import reverse
+from django.utils.translation import ugettext as _
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.platypus import (
- Paragraph,
- Table,
+ Image,
KeepTogether,
ListFlowable,
ListItem,
- Image
+ Paragraph,
+ Table
)
-from django.core.urlresolvers import reverse
-from django.utils.translation import ugettext as _
+# wger
from wger.utils.helpers import normalize_decimal
-
from wger.utils.pdf import styleSheet
diff --git a/wger/manager/management/commands/email-reminders.py b/wger/manager/management/commands/email-reminders.py
index ed70070e0..aee8887df 100644
--- a/wger/manager/management/commands/email-reminders.py
+++ b/wger/manager/management/commands/email-reminders.py
@@ -14,16 +14,19 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
-from django.template import loader
-from django.core.management.base import BaseCommand
+# Third Party
+from django.conf import settings
+from django.contrib.sites.models import Site
from django.core import mail
-from django.utils.translation import ugettext_lazy as _
+from django.core.management.base import BaseCommand
+from django.template import loader
from django.utils import translation
-from django.conf import settings
+from django.utils.translation import ugettext_lazy as _
-from django.contrib.sites.models import Site
+# wger
from wger.core.models import UserProfile
from wger.manager.models import Schedule
diff --git a/wger/manager/models.py b/wger/manager/models.py
index e6047415a..8096d5065 100644
--- a/wger/manager/models.py
+++ b/wger/manager/models.py
@@ -15,23 +15,34 @@
# 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/>.
+# Standard Library
import datetime
import logging
-from django.utils.encoding import python_2_unicode_compatible
+# Third Party
import six
-from django.db import models
-from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
-from django.core.validators import MaxValueValidator
-from django.core.urlresolvers import reverse
-from django.core.exceptions import ObjectDoesNotExist
-from django.core.exceptions import ValidationError
from django.core.cache import cache
-from django.core.validators import MinValueValidator
+from django.core.exceptions import (
+ ObjectDoesNotExist,
+ ValidationError
+)
+from django.core.urlresolvers import reverse
+from django.core.validators import (
+ MaxValueValidator,
+ 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
-from wger.core.models import DaysOfWeek, RepetitionUnit, WeightUnit
+# wger
+from wger.core.models import (
+ DaysOfWeek,
+ RepetitionUnit,
+ WeightUnit
+)
from wger.exercises.models import Exercise
from wger.manager.helpers import reps_smart_text
from wger.utils.cache import (
diff --git a/wger/manager/signals.py b/wger/manager/signals.py
index 2b7371d8e..2a6649c08 100644
--- a/wger/manager/signals.py
+++ b/wger/manager/signals.py
@@ -14,13 +14,24 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.db.models import Q
-from django.db.models.signals import post_save, pre_delete
+from django.db.models.signals import (
+ post_save,
+ pre_delete
+)
+# wger
from wger.core.models import Language
-from wger.exercises.models import Exercise, Muscle
+from wger.exercises.models import (
+ Exercise,
+ Muscle
+)
from wger.gym.helpers import get_user_last_activity
-from wger.manager.models import WorkoutLog, WorkoutSession
+from wger.manager.models import (
+ WorkoutLog,
+ WorkoutSession
+)
from wger.utils.cache import delete_template_fragment_cache
diff --git a/wger/manager/tests/test_copy_workout.py b/wger/manager/tests/test_copy_workout.py
index 75e38d077..abc0e9323 100644
--- a/wger/manager/tests/test_copy_workout.py
+++ b/wger/manager/tests/test_copy_workout.py
@@ -12,14 +12,18 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.models import UserProfile
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.manager.models import Workout
+
logger = logging.getLogger(__name__)
diff --git a/wger/manager/tests/test_day.py b/wger/manager/tests/test_day.py
index 74a99585b..9e04302ae 100644
--- a/wger/manager/tests/test_day.py
+++ b/wger/manager/tests/test_day.py
@@ -12,12 +12,16 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.cache import cache
from django.core.urlresolvers import reverse
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-from wger.core.tests.base_testcase import WorkoutManagerTestCase
+# wger
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAddTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
from wger.manager.models import Day
from wger.utils.cache import cache_mapper
diff --git a/wger/manager/tests/test_email_reminder.py b/wger/manager/tests/test_email_reminder.py
index 11f75a8b6..015784bdc 100644
--- a/wger/manager/tests/test_email_reminder.py
+++ b/wger/manager/tests/test_email_reminder.py
@@ -12,16 +12,21 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
+# Third Party
from django.contrib.auth.models import User
from django.core import mail
from django.core.management import call_command
+# wger
from wger.core.models import UserProfile
from wger.core.tests.base_testcase import WorkoutManagerTestCase
-from wger.manager.models import Schedule
-from wger.manager.models import Workout
+from wger.manager.models import (
+ Schedule,
+ Workout
+)
class EmailReminderTestCase(WorkoutManagerTestCase):
diff --git a/wger/manager/tests/test_ical.py b/wger/manager/tests/test_ical.py
index 040326d30..710697752 100644
--- a/wger/manager/tests/test_ical.py
+++ b/wger/manager/tests/test_ical.py
@@ -12,13 +12,19 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
-from wger.utils.helpers import next_weekday, make_token
+from wger.utils.helpers import (
+ make_token,
+ next_weekday
+)
# TODO: parse the generated calendar files with the icalendar library
diff --git a/wger/manager/tests/test_pdf.py b/wger/manager/tests/test_pdf.py
index dd3231417..34a49958b 100644
--- a/wger/manager/tests/test_pdf.py
+++ b/wger/manager/tests/test_pdf.py
@@ -11,9 +11,12 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.utils.helpers import make_token
diff --git a/wger/manager/tests/test_schedule.py b/wger/manager/tests/test_schedule.py
index 028f963bb..762c1a25a 100644
--- a/wger/manager/tests/test_schedule.py
+++ b/wger/manager/tests/test_schedule.py
@@ -12,23 +12,31 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
import logging
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import STATUS_CODES_FAIL
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-from wger.core.tests.base_testcase import WorkoutManagerTestCase
-from wger.manager.models import Schedule
-from wger.manager.models import ScheduleStep
-from wger.manager.models import Workout
+from wger.core.tests.base_testcase import (
+ STATUS_CODES_FAIL,
+ WorkoutManagerAddTestCase,
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
+from wger.manager.models import (
+ Schedule,
+ ScheduleStep,
+ Workout
+)
from wger.utils.helpers import make_token
+
logger = logging.getLogger(__name__)
diff --git a/wger/manager/tests/test_schedule_step.py b/wger/manager/tests/test_schedule_step.py
index d0389cfe8..ff3c491ad 100644
--- a/wger/manager/tests/test_schedule_step.py
+++ b/wger/manager/tests/test_schedule_step.py
@@ -11,15 +11,21 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Standard Library
import datetime
+# Third Party
from django.core.urlresolvers import reverse_lazy
+# wger
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-from wger.core.tests.base_testcase import WorkoutManagerTestCase
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAddTestCase,
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
from wger.manager.models import ScheduleStep
diff --git a/wger/manager/tests/test_set.py b/wger/manager/tests/test_set.py
index 8c1e1be3f..3e2a16115 100644
--- a/wger/manager/tests/test_set.py
+++ b/wger/manager/tests/test_set.py
@@ -12,20 +12,29 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.core.cache import cache
-from django.core.urlresolvers import reverse
-from django.core.urlresolvers import reverse_lazy
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+# wger
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import STATUS_CODES_FAIL
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerTestCase
+from wger.core.tests.base_testcase import (
+ STATUS_CODES_FAIL,
+ WorkoutManagerAddTestCase,
+ WorkoutManagerTestCase
+)
from wger.exercises.models import Exercise
-from wger.manager.models import Day
-from wger.manager.models import Set
-from wger.manager.models import Setting
+from wger.manager.models import (
+ Day,
+ Set,
+ Setting
+)
from wger.utils.cache import cache_mapper
diff --git a/wger/manager/tests/test_timer.py b/wger/manager/tests/test_timer.py
index a7eab1867..e6c30d224 100644
--- a/wger/manager/tests/test_timer.py
+++ b/wger/manager/tests/test_timer.py
@@ -12,18 +12,24 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
import logging
import math
from decimal import Decimal
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.exercises.models import Exercise
-from wger.manager.models import Workout
-from wger.manager.models import WorkoutSession
+from wger.manager.models import (
+ Workout,
+ WorkoutSession
+)
+
logger = logging.getLogger(__name__)
diff --git a/wger/manager/tests/test_weight_log.py b/wger/manager/tests/test_weight_log.py
index 4302cad70..9d2d73541 100644
--- a/wger/manager/tests/test_weight_log.py
+++ b/wger/manager/tests/test_weight_log.py
@@ -12,22 +12,33 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
import logging
+# Third Party
from django.contrib.auth.models import User
from django.core.cache import cache
-from django.core.urlresolvers import reverse, reverse_lazy
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+# wger
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase
-from wger.core.tests.base_testcase import WorkoutManagerTestCase
+from wger.core.tests.base_testcase import (
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerTestCase
+)
from wger.exercises.models import Exercise
-from wger.manager.models import Workout
-from wger.manager.models import WorkoutLog
-from wger.manager.models import WorkoutSession
+from wger.manager.models import (
+ Workout,
+ WorkoutLog,
+ WorkoutSession
+)
from wger.utils.cache import cache_mapper
+
logger = logging.getLogger(__name__)
diff --git a/wger/manager/tests/test_workout.py b/wger/manager/tests/test_workout.py
index 439edb0f9..f7ce39c06 100644
--- a/wger/manager/tests/test_workout.py
+++ b/wger/manager/tests/test_workout.py
@@ -12,14 +12,19 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-from wger.core.tests.base_testcase import WorkoutManagerTestCase
+from wger.core.tests.base_testcase import (
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
from wger.manager.models import Workout
diff --git a/wger/manager/tests/test_workout_canonical.py b/wger/manager/tests/test_workout_canonical.py
index f5b2acb02..4259dbe83 100644
--- a/wger/manager/tests/test_workout_canonical.py
+++ b/wger/manager/tests/test_workout_canonical.py
@@ -12,10 +12,13 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
from decimal import Decimal
+# Third Party
from django.core.cache import cache
+# wger
from wger.core.models import (
DaysOfWeek,
RepetitionUnit,
@@ -24,10 +27,10 @@ from wger.core.models import (
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.exercises.models import Exercise
from wger.manager.models import (
- Workout,
Day,
Set,
- Setting
+ Setting,
+ Workout
)
from wger.utils.cache import cache_mapper
diff --git a/wger/manager/tests/test_workout_session.py b/wger/manager/tests/test_workout_session.py
index 565a6f4e5..d95a44530 100644
--- a/wger/manager/tests/test_workout_session.py
+++ b/wger/manager/tests/test_workout_session.py
@@ -12,18 +12,31 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
+# Third Party
from django.contrib.auth.models import User
from django.core.cache import cache
from django.core.exceptions import ValidationError
-from django.core.urlresolvers import reverse, reverse_lazy
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+# wger
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-from wger.core.tests.base_testcase import WorkoutManagerTestCase, WorkoutManagerDeleteTestCase
-from wger.manager.models import Workout, WorkoutSession, WorkoutLog
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAddTestCase,
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
+from wger.manager.models import (
+ Workout,
+ WorkoutLog,
+ WorkoutSession
+)
from wger.utils.cache import cache_mapper
diff --git a/wger/manager/urls.py b/wger/manager/urls.py
index 97c78aad5..56ae3b8f9 100644
--- a/wger/manager/urls.py
+++ b/wger/manager/urls.py
@@ -15,21 +15,27 @@
# 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/>.
-from django.conf.urls import url, include
+# Third Party
+from django.conf.urls import (
+ include,
+ url
+)
from django.contrib.auth.decorators import login_required
+# wger
from wger.manager.views import (
+ day,
+ ical,
+ log,
pdf,
schedule,
schedule_step,
- ical,
- workout,
- log,
set,
- day,
+ workout,
workout_session
)
+
# sub patterns for workout logs
patterns_log = [
url(r'^(?P<pk>\d+)/view$',
diff --git a/wger/manager/views/day.py b/wger/manager/views/day.py
index 3a488fe84..f16126c58 100644
--- a/wger/manager/views/day.py
+++ b/wger/manager/views/day.py
@@ -14,22 +14,34 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
+from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
-from django.shortcuts import render
-from django.shortcuts import get_object_or_404
-from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
-from django.utils.translation import ugettext_lazy
-from django.utils.translation import ugettext as _
-from django.contrib.auth.decorators import login_required
-from django.views.generic import CreateView
-from django.views.generic import UpdateView
-
+from django.http import HttpResponseRedirect
+from django.shortcuts import (
+ get_object_or_404,
+ render
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
+from django.views.generic import (
+ CreateView,
+ UpdateView
+)
+
+# wger
from wger.core.models import DaysOfWeek
-from wger.manager.models import Workout, Day
from wger.manager.forms import DayForm
+from wger.manager.models import (
+ Day,
+ Workout
+)
from wger.utils.generic_views import WgerFormMixin
diff --git a/wger/manager/views/ical.py b/wger/manager/views/ical.py
index 2a53d3dfb..4f89da6d9 100644
--- a/wger/manager/views/ical.py
+++ b/wger/manager/views/ical.py
@@ -14,21 +14,34 @@
#
# You should have received a copy of the GNU Affero General Public License
-import six
-import logging
+# Standard Library
import datetime
+import logging
-from icalendar import Calendar
-from icalendar import Event
-from icalendar.tools import UIDGenerator
-
-from django.shortcuts import get_object_or_404
-from django.http import HttpResponse, HttpResponseForbidden
+# Third Party
+import six
from django.contrib.sites.models import Site
+from django.http import (
+ HttpResponse,
+ HttpResponseForbidden
+)
+from django.shortcuts import get_object_or_404
+from icalendar import (
+ Calendar,
+ Event
+)
+from icalendar.tools import UIDGenerator
+# wger
from wger import get_version
-from wger.manager.models import Workout, Schedule
-from wger.utils.helpers import next_weekday, check_token
+from wger.manager.models import (
+ Schedule,
+ Workout
+)
+from wger.utils.helpers import (
+ check_token,
+ next_weekday
+)
logger = logging.getLogger(__name__)
diff --git a/wger/manager/views/log.py b/wger/manager/views/log.py
index 8b946aac2..0a2d738d6 100644
--- a/wger/manager/views/log.py
+++ b/wger/manager/views/log.py
@@ -14,43 +14,60 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
+import datetime
import logging
import uuid
-import datetime
+# Third Party
from django.contrib.auth.mixins import LoginRequiredMixin
-from django.shortcuts import render
-from django.shortcuts import get_object_or_404
-from django.http import HttpResponseRedirect, HttpResponseForbidden
-from django.template.context_processors import csrf
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.utils.translation import ugettext_lazy, ugettext as _
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
from django.forms.models import modelformset_factory
+from django.http import (
+ HttpResponseForbidden,
+ HttpResponseRedirect
+)
+from django.shortcuts import (
+ get_object_or_404,
+ render
+)
+from django.template.context_processors import csrf
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- UpdateView,
+ DeleteView,
DetailView,
- DeleteView
+ UpdateView
)
-from wger.manager.helpers import WorkoutCalendar
-from wger.manager.models import (
- Workout,
- WorkoutSession,
- Day,
- WorkoutLog,
- Schedule
-)
+# wger
from wger.manager.forms import (
HelperDateForm,
HelperWorkoutSessionForm,
WorkoutLogForm
)
+from wger.manager.helpers import WorkoutCalendar
+from wger.manager.models import (
+ Day,
+ Schedule,
+ Workout,
+ WorkoutLog,
+ WorkoutSession
+)
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
from wger.utils.helpers import check_access
-from wger.weight.helpers import process_log_entries, group_log_entries
+from wger.weight.helpers import (
+ group_log_entries,
+ process_log_entries
+)
logger = logging.getLogger(__name__)
diff --git a/wger/manager/views/pdf.py b/wger/manager/views/pdf.py
index c12d71eea..182d9321e 100644
--- a/wger/manager/views/pdf.py
+++ b/wger/manager/views/pdf.py
@@ -14,26 +14,35 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.http import HttpResponse
-from django.http import HttpResponseForbidden
+# Third Party
+from django.http import (
+ HttpResponse,
+ HttpResponseForbidden
+)
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext as _
-
-from wger.manager.models import Workout
-from wger.manager.helpers import render_workout_day
-from wger.utils.helpers import check_token
-from wger.utils.pdf import styleSheet
-from wger.utils.pdf import render_footer
-
-from reportlab.lib.pagesizes import A4, cm
+from reportlab.lib.pagesizes import (
+ A4,
+ cm
+)
from reportlab.platypus import (
Paragraph,
SimpleDocTemplate,
Spacer
)
+# wger
+from wger.manager.helpers import render_workout_day
+from wger.manager.models import Workout
+from wger.utils.helpers import check_token
+from wger.utils.pdf import (
+ render_footer,
+ styleSheet
+)
+
logger = logging.getLogger(__name__)
diff --git a/wger/manager/views/schedule.py b/wger/manager/views/schedule.py
index 2f45fa70f..2337c37ef 100644
--- a/wger/manager/views/schedule.py
+++ b/wger/manager/views/schedule.py
@@ -14,41 +14,58 @@
#
# You should have received a copy of the GNU Affero General Public License
-import logging
+# Standard Library
import datetime
+import logging
-from django.shortcuts import render, get_object_or_404
+# Third Party
+from django.contrib.auth.decorators import login_required
+from django.contrib.auth.mixins import PermissionRequiredMixin
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
from django.http import (
- HttpResponseRedirect,
+ HttpResponse,
HttpResponseForbidden,
- HttpResponse
+ HttpResponseRedirect
+)
+from django.shortcuts import (
+ get_object_or_404,
+ render
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
)
-from django.core.urlresolvers import reverse_lazy, reverse
-from django.utils.translation import ugettext_lazy, ugettext as _
-from django.contrib.auth.mixins import PermissionRequiredMixin
-from django.contrib.auth.decorators import login_required
from django.views.generic import (
CreateView,
DeleteView,
UpdateView
)
-
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm
from reportlab.platypus import (
- SimpleDocTemplate,
Paragraph,
+ SimpleDocTemplate,
Spacer
)
-from wger.manager.models import Schedule
+# wger
from wger.manager.helpers import render_workout_day
+from wger.manager.models import Schedule
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
+)
+from wger.utils.helpers import (
+ check_token,
+ make_token
+)
+from wger.utils.pdf import (
+ render_footer,
+ styleSheet
)
-from wger.utils.helpers import make_token, check_token
-from wger.utils.pdf import styleSheet, render_footer
logger = logging.getLogger(__name__)
diff --git a/wger/manager/views/schedule_step.py b/wger/manager/views/schedule_step.py
index da228b112..23dbce19f 100644
--- a/wger/manager/views/schedule_step.py
+++ b/wger/manager/views/schedule_step.py
@@ -14,27 +14,36 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.urlresolvers import reverse
-from django.utils.translation import ugettext_lazy, ugettext as _
from django.db import models
-from django.forms import ModelForm, ModelChoiceField
+from django.forms import (
+ ModelChoiceField,
+ ModelForm
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
CreateView,
DeleteView,
UpdateView
)
+# wger
from wger.manager.models import (
Schedule,
ScheduleStep,
Workout
)
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
diff --git a/wger/manager/views/set.py b/wger/manager/views/set.py
index 080f1a11f..f8242f48c 100644
--- a/wger/manager/views/set.py
+++ b/wger/manager/views/set.py
@@ -14,29 +14,42 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.forms.models import modelformset_factory, inlineformset_factory
-from django.shortcuts import render, get_object_or_404
-from django.http import HttpResponseRedirect, HttpResponseForbidden
-from django.core.urlresolvers import reverse
+# Third Party
+from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
+from django.core.urlresolvers import reverse
from django.db import models
-from django.contrib.auth.decorators import login_required
-
-from wger.manager.models import (
- Day,
- Set,
- Setting
+from django.forms.models import (
+ inlineformset_factory,
+ modelformset_factory
+)
+from django.http import (
+ HttpResponseForbidden,
+ HttpResponseRedirect
)
+from django.shortcuts import (
+ get_object_or_404,
+ render
+)
+
+# wger
+from wger.config.models import LanguageConfig
from wger.exercises.models import Exercise
from wger.manager.forms import (
SetForm,
SetFormMobile,
SettingForm
)
+from wger.manager.models import (
+ Day,
+ Set,
+ Setting
+)
from wger.utils.language import load_item_languages
-from wger.config.models import LanguageConfig
+
logger = logging.getLogger(__name__)
diff --git a/wger/manager/views/workout.py b/wger/manager/views/workout.py
index d9234aa26..4154fd890 100644
--- a/wger/manager/views/workout.py
+++ b/wger/manager/views/workout.py
@@ -14,38 +14,56 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
+import datetime
import logging
import uuid
-import datetime
-from django.shortcuts import render, get_object_or_404
-from django.http import HttpResponseRedirect, HttpResponseForbidden
-from django.template.context_processors import csrf
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.utils.translation import ugettext_lazy, ugettext as _
-from django.contrib.auth.mixins import LoginRequiredMixin
+# Third Party
from django.contrib.auth.decorators import login_required
-from django.views.generic import DeleteView, UpdateView
+from django.contrib.auth.mixins import LoginRequiredMixin
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.http import (
+ HttpResponseForbidden,
+ HttpResponseRedirect
+)
+from django.shortcuts import (
+ get_object_or_404,
+ render
+)
+from django.template.context_processors import csrf
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
+from django.views.generic import (
+ DeleteView,
+ UpdateView
+)
+# wger
from wger.core.models import (
RepetitionUnit,
WeightUnit
)
+from wger.manager.forms import (
+ WorkoutCopyForm,
+ WorkoutForm,
+ WorkoutSessionHiddenFieldsForm
+)
from wger.manager.models import (
+ Day,
+ Schedule,
Workout,
- WorkoutSession,
WorkoutLog,
- Schedule,
- Day
-)
-from wger.manager.forms import (
- WorkoutForm,
- WorkoutSessionHiddenFieldsForm,
- WorkoutCopyForm
+ WorkoutSession
)
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
from wger.utils.helpers import make_token
diff --git a/wger/manager/views/workout_session.py b/wger/manager/views/workout_session.py
index 12cd4adf6..dcd559881 100644
--- a/wger/manager/views/workout_session.py
+++ b/wger/manager/views/workout_session.py
@@ -14,28 +14,40 @@
#
# You should have received a copy of the GNU Affero General Public License
-import logging
+# Standard Library
import datetime
+import logging
+# Third Party
from django.contrib.auth.mixins import LoginRequiredMixin
-from django.http import HttpResponseForbidden, HttpResponseBadRequest
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.utils.translation import ugettext_lazy, ugettext as _
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.http import (
+ HttpResponseBadRequest,
+ HttpResponseForbidden
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- UpdateView,
+ CreateView,
DeleteView,
- CreateView
+ UpdateView
)
+# wger
from wger.manager.forms import WorkoutSessionForm
from wger.manager.models import (
Workout,
- WorkoutSession,
- WorkoutLog
+ WorkoutLog,
+ WorkoutSession
)
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
diff --git a/wger/nutrition/api/resources.py b/wger/nutrition/api/resources.py
index 74740a5c7..21af0326a 100644
--- a/wger/nutrition/api/resources.py
+++ b/wger/nutrition/api/resources.py
@@ -14,21 +14,29 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from tastypie import fields
from tastypie.authentication import ApiKeyAuthentication
+from tastypie.constants import (
+ ALL,
+ ALL_WITH_RELATIONS
+)
from tastypie.resources import ModelResource
-from tastypie.constants import ALL, ALL_WITH_RELATIONS
+# wger
+from wger.core.api.resources import (
+ LanguageResource,
+ LicenseResource
+)
from wger.nutrition.models import (
Ingredient,
- WeightUnit,
IngredientWeightUnit,
- NutritionPlan,
Meal,
- MealItem
+ MealItem,
+ NutritionPlan,
+ WeightUnit
)
from wger.utils.resources import UserObjectsOnlyAuthorization
-from wger.core.api.resources import LicenseResource, LanguageResource
class IngredientResource(ModelResource):
diff --git a/wger/nutrition/api/serializers.py b/wger/nutrition/api/serializers.py
index 1c2902e1e..10ebe5abd 100644
--- a/wger/nutrition/api/serializers.py
+++ b/wger/nutrition/api/serializers.py
@@ -15,14 +15,17 @@
# 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/>.
+# Third Party
from rest_framework import serializers
+
+# wger
from wger.nutrition.models import (
- NutritionPlan,
+ Ingredient,
IngredientWeightUnit,
- WeightUnit,
- MealItem,
Meal,
- Ingredient
+ MealItem,
+ NutritionPlan,
+ WeightUnit
)
diff --git a/wger/nutrition/api/views.py b/wger/nutrition/api/views.py
index a9ac43ff5..a065bf17b 100644
--- a/wger/nutrition/api/views.py
+++ b/wger/nutrition/api/views.py
@@ -15,29 +15,36 @@
# 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/>.
+# Third Party
from rest_framework import viewsets
-from rest_framework.decorators import detail_route
-from rest_framework.decorators import api_view
+from rest_framework.decorators import (
+ api_view,
+ detail_route
+)
from rest_framework.response import Response
+# wger
from wger.nutrition.api.serializers import (
- NutritionPlanSerializer,
+ IngredientSerializer,
IngredientWeightUnitSerializer,
- WeightUnitSerializer,
MealItemSerializer,
MealSerializer,
- IngredientSerializer
+ NutritionPlanSerializer,
+ WeightUnitSerializer
)
from wger.nutrition.forms import UnitChooserForm
from wger.nutrition.models import (
Ingredient,
+ IngredientWeightUnit,
Meal,
MealItem,
- WeightUnit,
- IngredientWeightUnit,
- NutritionPlan
+ NutritionPlan,
+ WeightUnit
+)
+from wger.utils.language import (
+ load_ingredient_languages,
+ load_language
)
-from wger.utils.language import load_ingredient_languages, load_language
from wger.utils.viewsets import WgerOwnerObjectModelViewSet
diff --git a/wger/nutrition/forms.py b/wger/nutrition/forms.py
index 0e3277ded..36603b2de 100644
--- a/wger/nutrition/forms.py
+++ b/wger/nutrition/forms.py
@@ -14,15 +14,18 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django import forms
from django.utils.translation import ugettext as _
-from wger.core.models import UserProfile
+# wger
+from wger.core.models import UserProfile
from wger.nutrition.models import (
- IngredientWeightUnit,
Ingredient,
+ IngredientWeightUnit,
MealItem
)
from wger.utils.widgets import Html5NumberInput
diff --git a/wger/nutrition/models.py b/wger/nutrition/models.py
index f472fd38c..a2476f4f5 100644
--- a/wger/nutrition/models.py
+++ b/wger/nutrition/models.py
@@ -10,37 +10,48 @@
# 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.
-#
+
+
+# Standard Library
# 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/>.
import logging
+# GNU General Public License for more details.
+#
from decimal import Decimal
-from django.db import models
-
-from django.template.loader import render_to_string
-from django.template.defaultfilters import slugify # django.utils.text.slugify in django 1.5!
-from django.core.validators import MaxValueValidator, MinValueValidator
-from django.core.exceptions import ValidationError
-from django.core.urlresolvers import reverse
-from django.core import mail
-from django.core.cache import cache
+# Third Party
+from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
+from django.core import mail
+from django.core.cache import cache
+from django.core.exceptions import ValidationError
+from django.core.urlresolvers import reverse
+from django.core.validators import (
+ MaxValueValidator,
+ MinValueValidator
+)
+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 _
-from django.utils import translation
-from django.conf import settings
+# wger
from wger.core.models import Language
-from wger.utils.constants import TWOPLACES
from wger.utils.cache import cache_mapper
+from wger.utils.constants import TWOPLACES
from wger.utils.fields import Html5TimeField
-from wger.utils.models import AbstractLicenseModel, AbstractSubmissionModel
+from wger.utils.models import (
+ AbstractLicenseModel,
+ AbstractSubmissionModel
+)
from wger.utils.units import AbstractWeight
from wger.weight.models import WeightEntry
+
MEALITEM_WEIGHT_GRAM = '1'
MEALITEM_WEIGHT_UNIT = '2'
diff --git a/wger/nutrition/sitemap.py b/wger/nutrition/sitemap.py
index db92daed7..dd0337a6d 100644
--- a/wger/nutrition/sitemap.py
+++ b/wger/nutrition/sitemap.py
@@ -14,8 +14,10 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.contrib.sitemaps import Sitemap
+# wger
from wger.nutrition.models import Ingredient
from wger.utils.language import load_language
diff --git a/wger/nutrition/tests/test_bmi.py b/wger/nutrition/tests/test_bmi.py
index 5724dc770..3f04dc3c0 100644
--- a/wger/nutrition/tests/test_bmi.py
+++ b/wger/nutrition/tests/test_bmi.py
@@ -12,13 +12,16 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
import json
from decimal import Decimal
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+# wger
from wger.core.models import UserProfile
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.utils.constants import TWOPLACES
diff --git a/wger/nutrition/tests/test_calories_calculator.py b/wger/nutrition/tests/test_calories_calculator.py
index dd9020718..233074d31 100644
--- a/wger/nutrition/tests/test_calories_calculator.py
+++ b/wger/nutrition/tests/test_calories_calculator.py
@@ -12,13 +12,16 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
import decimal
import json
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.utils.constants import TWOPLACES
from wger.weight.models import WeightEntry
diff --git a/wger/nutrition/tests/test_copy_plan.py b/wger/nutrition/tests/test_copy_plan.py
index 6caaa425d..04cb3517d 100644
--- a/wger/nutrition/tests/test_copy_plan.py
+++ b/wger/nutrition/tests/test_copy_plan.py
@@ -12,8 +12,10 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.nutrition.models import NutritionPlan
diff --git a/wger/nutrition/tests/test_ingredient.py b/wger/nutrition/tests/test_ingredient.py
index 5b03f8bd4..eda164ed7 100644
--- a/wger/nutrition/tests/test_ingredient.py
+++ b/wger/nutrition/tests/test_ingredient.py
@@ -13,23 +13,28 @@
# 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/>.
+# Standard Library
import datetime
import json
from decimal import Decimal
+# Third Party
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
+# wger
from wger.core.models import Language
from wger.core.tests import api_base_test
from wger.core.tests.base_testcase import (
- WorkoutManagerTestCase,
+ WorkoutManagerAddTestCase,
WorkoutManagerDeleteTestCase,
WorkoutManagerEditTestCase,
- WorkoutManagerAddTestCase
+ WorkoutManagerTestCase
+)
+from wger.nutrition.models import (
+ Ingredient,
+ Meal
)
-from wger.nutrition.models import Ingredient
-from wger.nutrition.models import Meal
from wger.utils.constants import NUTRITION_TAB
diff --git a/wger/nutrition/tests/test_ingredient_overview.py b/wger/nutrition/tests/test_ingredient_overview.py
index 4a39b4f5a..0fcd07fa0 100644
--- a/wger/nutrition/tests/test_ingredient_overview.py
+++ b/wger/nutrition/tests/test_ingredient_overview.py
@@ -13,8 +13,10 @@
# 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/>.
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGE
diff --git a/wger/nutrition/tests/test_meal.py b/wger/nutrition/tests/test_meal.py
index ab670fc2d..5062acba3 100644
--- a/wger/nutrition/tests/test_meal.py
+++ b/wger/nutrition/tests/test_meal.py
@@ -13,18 +13,23 @@
# 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/>.
+# Standard Library
import datetime
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests import api_base_test
from wger.core.tests.base_testcase import (
- WorkoutManagerTestCase,
+ WorkoutManagerAddTestCase,
WorkoutManagerEditTestCase,
- WorkoutManagerAddTestCase
+ WorkoutManagerTestCase
+)
+from wger.nutrition.models import (
+ Meal,
+ NutritionPlan
)
-from wger.nutrition.models import Meal
-from wger.nutrition.models import NutritionPlan
class MealRepresentationTestCase(WorkoutManagerTestCase):
diff --git a/wger/nutrition/tests/test_meal_item.py b/wger/nutrition/tests/test_meal_item.py
index 34a515fd7..9e540471d 100644
--- a/wger/nutrition/tests/test_meal_item.py
+++ b/wger/nutrition/tests/test_meal_item.py
@@ -13,11 +13,15 @@
# 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/>.
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAddTestCase,
+ WorkoutManagerEditTestCase
+)
from wger.nutrition.models import MealItem
diff --git a/wger/nutrition/tests/test_nutritional_calculations.py b/wger/nutrition/tests/test_nutritional_calculations.py
index d4dda128f..6bd8a51b9 100644
--- a/wger/nutrition/tests/test_nutritional_calculations.py
+++ b/wger/nutrition/tests/test_nutritional_calculations.py
@@ -13,13 +13,16 @@
# 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/>.
+# Standard Library
import logging
from decimal import Decimal
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.nutrition import models
from wger.utils.constants import TWOPLACES
+
logger = logging.getLogger(__name__)
diff --git a/wger/nutrition/tests/test_pdf.py b/wger/nutrition/tests/test_pdf.py
index 827d6ba42..0c09455fe 100644
--- a/wger/nutrition/tests/test_pdf.py
+++ b/wger/nutrition/tests/test_pdf.py
@@ -12,9 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+# wger
from wger.core.models import Language
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.nutrition.models import NutritionPlan
diff --git a/wger/nutrition/tests/test_plan.py b/wger/nutrition/tests/test_plan.py
index 0f485dbaa..a7133d54d 100644
--- a/wger/nutrition/tests/test_plan.py
+++ b/wger/nutrition/tests/test_plan.py
@@ -13,12 +13,16 @@
# 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/>.
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-from wger.core.tests.base_testcase import WorkoutManagerTestCase
+from wger.core.tests.base_testcase import (
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
from wger.nutrition.models import NutritionPlan
diff --git a/wger/nutrition/tests/test_submitted_ingredient.py b/wger/nutrition/tests/test_submitted_ingredient.py
index 3cdfe751f..a0d758524 100644
--- a/wger/nutrition/tests/test_submitted_ingredient.py
+++ b/wger/nutrition/tests/test_submitted_ingredient.py
@@ -12,9 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core import mail
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.nutrition.models import Ingredient
diff --git a/wger/nutrition/tests/test_weight_unit.py b/wger/nutrition/tests/test_weight_unit.py
index ab4e6096e..99417decf 100644
--- a/wger/nutrition/tests/test_weight_unit.py
+++ b/wger/nutrition/tests/test_weight_unit.py
@@ -13,13 +13,17 @@
# 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/>.
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-from wger.core.tests.base_testcase import WorkoutManagerTestCase
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAddTestCase,
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
from wger.nutrition.models import WeightUnit
from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGE
diff --git a/wger/nutrition/tests/test_weight_unit_ingredient.py b/wger/nutrition/tests/test_weight_unit_ingredient.py
index d1cdc3e68..e9521e345 100644
--- a/wger/nutrition/tests/test_weight_unit_ingredient.py
+++ b/wger/nutrition/tests/test_weight_unit_ingredient.py
@@ -13,16 +13,24 @@
# 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/>.
-from django.core.urlresolvers import reverse
-from django.core.urlresolvers import reverse_lazy
+# Third Party
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+# wger
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerDeleteTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase
-from wger.core.tests.base_testcase import WorkoutManagerTestCase
-from wger.nutrition.models import IngredientWeightUnit
-from wger.nutrition.models import WeightUnit
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAddTestCase,
+ WorkoutManagerDeleteTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
+from wger.nutrition.models import (
+ IngredientWeightUnit,
+ WeightUnit
+)
class WeightUnitIngredientRepresentationTestCase(WorkoutManagerTestCase):
diff --git a/wger/nutrition/urls.py b/wger/nutrition/urls.py
index 484284965..7dfca62c1 100644
--- a/wger/nutrition/urls.py
+++ b/wger/nutrition/urls.py
@@ -15,23 +15,26 @@
# 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/>.
-from django.contrib.auth.decorators import login_required
+# Third Party
from django.conf.urls import (
- url,
- include
+ include,
+ url
)
+from django.contrib.auth.decorators import login_required
+# wger
from wger.nutrition.views import (
- ingredient,
bmi,
calculator,
- plan,
+ ingredient,
meal,
meal_item,
+ plan,
unit,
unit_ingredient
)
+
# sub patterns for nutritional plans
patterns_plan = [
url(r'^overview/$',
diff --git a/wger/nutrition/views/bmi.py b/wger/nutrition/views/bmi.py
index 57a4c555c..3a36c191f 100644
--- a/wger/nutrition/views/bmi.py
+++ b/wger/nutrition/views/bmi.py
@@ -15,16 +15,20 @@
# 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/>.
-import logging
+# Standard Library
import json
+import logging
+# Third Party
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import render
+# wger
from wger.nutrition.forms import BmiForm
from wger.utils import helpers
+
logger = logging.getLogger(__name__)
'''
diff --git a/wger/nutrition/views/calculator.py b/wger/nutrition/views/calculator.py
index 17b4624c3..142768e8d 100644
--- a/wger/nutrition/views/calculator.py
+++ b/wger/nutrition/views/calculator.py
@@ -15,17 +15,20 @@
# 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/>.
-import logging
+# Standard Library
import json
+import logging
+# Third Party
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import render
+# wger
from wger.nutrition.forms import (
BmrForm,
- PhysicalActivitiesForm,
- DailyCaloriesForm
+ DailyCaloriesForm,
+ PhysicalActivitiesForm
)
diff --git a/wger/nutrition/views/ingredient.py b/wger/nutrition/views/ingredient.py
index 37cb358d9..3afb35d5b 100644
--- a/wger/nutrition/views/ingredient.py
+++ b/wger/nutrition/views/ingredient.py
@@ -13,32 +13,54 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Standard Library
import logging
-from django.shortcuts import render, get_object_or_404
-from django.http import HttpResponseRedirect, HttpResponseForbidden
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.core.cache import cache
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
-from django.contrib.auth.decorators import permission_required
+# Third Party
from django.contrib import messages
-from django.utils.translation import ugettext_lazy, ugettext as _
+from django.contrib.auth.decorators import permission_required
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
+from django.core.cache import cache
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.http import (
+ HttpResponseForbidden,
+ HttpResponseRedirect
+)
+from django.shortcuts import (
+ get_object_or_404,
+ render
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- DeleteView,
CreateView,
- UpdateView,
- ListView
+ DeleteView,
+ ListView,
+ UpdateView
)
+# wger
from wger.nutrition.forms import UnitChooserForm
from wger.nutrition.models import Ingredient
+from wger.utils.cache import cache_mapper
+from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGE
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
+)
+from wger.utils.language import (
+ load_ingredient_languages,
+ load_language
)
-from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGE
-from wger.utils.language import load_language, load_ingredient_languages
-from wger.utils.cache import cache_mapper
logger = logging.getLogger(__name__)
diff --git a/wger/nutrition/views/meal.py b/wger/nutrition/views/meal.py
index 291d8a591..ca3d1d1ce 100644
--- a/wger/nutrition/views/meal.py
+++ b/wger/nutrition/views/meal.py
@@ -13,19 +13,32 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Standard Library
import logging
-from django.shortcuts import get_object_or_404
-from django.http import HttpResponseRedirect, HttpResponseForbidden
-from django.core.urlresolvers import reverse
+# Third Party
from django.contrib.auth.decorators import login_required
+from django.core.urlresolvers import reverse
+from django.http import (
+ HttpResponseForbidden,
+ HttpResponseRedirect
+)
+from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext_lazy
-
-from django.views.generic import CreateView, UpdateView
-
-from wger.nutrition.models import NutritionPlan, Meal
+from django.views.generic import (
+ CreateView,
+ UpdateView
+)
+
+# wger
+from wger.nutrition.models import (
+ Meal,
+ NutritionPlan
+)
from wger.utils.generic_views import WgerFormMixin
+
logger = logging.getLogger(__name__)
diff --git a/wger/nutrition/views/meal_item.py b/wger/nutrition/views/meal_item.py
index 20f1c3660..a5327b77e 100644
--- a/wger/nutrition/views/meal_item.py
+++ b/wger/nutrition/views/meal_item.py
@@ -13,17 +13,30 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Standard Library
import logging
-from django.shortcuts import get_object_or_404
-from django.http import HttpResponseRedirect, HttpResponseForbidden
-from django.core.urlresolvers import reverse
+# Third Party
from django.contrib.auth.decorators import login_required
+from django.core.urlresolvers import reverse
+from django.http import (
+ HttpResponseForbidden,
+ HttpResponseRedirect
+)
+from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext_lazy
-from django.views.generic import CreateView, UpdateView
+from django.views.generic import (
+ CreateView,
+ UpdateView
+)
+# wger
from wger.nutrition.forms import MealItemForm
-from wger.nutrition.models import Meal, MealItem
+from wger.nutrition.models import (
+ Meal,
+ MealItem
+)
from wger.utils.generic_views import WgerFormMixin
diff --git a/wger/nutrition/views/plan.py b/wger/nutrition/views/plan.py
index 56b4bcdad..ddd947bb9 100644
--- a/wger/nutrition/views/plan.py
+++ b/wger/nutrition/views/plan.py
@@ -14,41 +14,64 @@
#
# You should have received a copy of the GNU Affero General Public License
-import six
-import logging
+# Standard Library
import datetime
+import logging
-from django.shortcuts import render, get_object_or_404
+# Third Party
+import six
+from django.contrib.auth.decorators import login_required
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
from django.http import (
HttpResponse,
HttpResponseForbidden,
HttpResponseRedirect
)
+from django.shortcuts import (
+ get_object_or_404,
+ render
+)
from django.template.context_processors import csrf
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.contrib.auth.decorators import login_required
-from django.utils.translation import ugettext_lazy, ugettext as _
-from django.views.generic import DeleteView, UpdateView
-
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
+from django.views.generic import (
+ DeleteView,
+ UpdateView
+)
from reportlab.lib import colors
-from reportlab.lib.pagesizes import A4, cm
+from reportlab.lib.pagesizes import (
+ A4,
+ cm
+)
from reportlab.platypus import (
Paragraph,
SimpleDocTemplate,
- Table,
- Spacer
+ Spacer,
+ Table
)
+# wger
+from wger import get_version
from wger.nutrition.models import (
- NutritionPlan,
MEALITEM_WEIGHT_GRAM,
- MEALITEM_WEIGHT_UNIT
+ MEALITEM_WEIGHT_UNIT,
+ NutritionPlan
+)
+from wger.utils.generic_views import (
+ WgerDeleteMixin,
+ WgerFormMixin
+)
+from wger.utils.helpers import (
+ check_token,
+ make_token
)
-from wger import get_version
-from wger.utils.generic_views import WgerFormMixin, WgerDeleteMixin
-from wger.utils.helpers import check_token, make_token
-from wger.utils.pdf import styleSheet
from wger.utils.language import load_language
+from wger.utils.pdf import styleSheet
logger = logging.getLogger(__name__)
diff --git a/wger/nutrition/views/unit.py b/wger/nutrition/views/unit.py
index c1286c8d0..041e36ddd 100644
--- a/wger/nutrition/views/unit.py
+++ b/wger/nutrition/views/unit.py
@@ -13,26 +13,39 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-import logging
-from django.core.urlresolvers import reverse, reverse_lazy
-from django.utils.translation import ugettext_lazy, ugettext as _
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
+# Standard Library
+import logging
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
from django.views.generic import (
- DeleteView,
CreateView,
- UpdateView,
- ListView
+ DeleteView,
+ ListView,
+ UpdateView
)
+# wger
from wger.nutrition.models import WeightUnit
from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGE
-from wger.utils.language import load_language
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
+from wger.utils.language import load_language
+
logger = logging.getLogger(__name__)
# ************************
diff --git a/wger/nutrition/views/unit_ingredient.py b/wger/nutrition/views/unit_ingredient.py
index 774752b65..cdc822716 100644
--- a/wger/nutrition/views/unit_ingredient.py
+++ b/wger/nutrition/views/unit_ingredient.py
@@ -13,29 +13,39 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
+
+# Standard Library
import logging
-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin
-from django.shortcuts import get_object_or_404
+# Third Party
+from django.contrib.auth.mixins import (
+ LoginRequiredMixin,
+ PermissionRequiredMixin
+)
from django.core.urlresolvers import reverse
-from django.forms import ModelForm, ModelChoiceField
+from django.forms import (
+ ModelChoiceField,
+ ModelForm
+)
+from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext_lazy
-
-from wger.utils.language import load_language
from django.views.generic import (
- DeleteView,
CreateView,
+ DeleteView,
UpdateView
)
+
+# wger
from wger.nutrition.models import (
Ingredient,
IngredientWeightUnit,
WeightUnit
)
from wger.utils.generic_views import (
- WgerFormMixin,
- WgerDeleteMixin
+ WgerDeleteMixin,
+ WgerFormMixin
)
+from wger.utils.language import load_language
logger = logging.getLogger(__name__)
diff --git a/wger/settings_global.py b/wger/settings_global.py
index ecbc3bea3..ea5b52119 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -14,17 +14,19 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+import os
import re
import sys
+
'''
This file contains the global settings that don't usually need to be changed.
For a full list of options, visit:
https://docs.djangoproject.com/en/dev/ref/settings/
'''
-# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
-import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
diff --git a/wger/software/urls.py b/wger/software/urls.py
index e1f9c77dc..a86b22854 100644
--- a/wger/software/urls.py
+++ b/wger/software/urls.py
@@ -14,11 +14,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.conf.urls import url
-from django.views.generic import TemplateView, RedirectView
+from django.views.generic import (
+ RedirectView,
+ TemplateView
+)
+# wger
from wger.software import views
+
urlpatterns = [
url(r'^issues$',
diff --git a/wger/software/views.py b/wger/software/views.py
index 472e3d60a..a29ef7591 100644
--- a/wger/software/views.py
+++ b/wger/software/views.py
@@ -14,12 +14,14 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.conf import settings
-
from django.shortcuts import render
+
logger = logging.getLogger(__name__)
diff --git a/wger/tasks.py b/wger/tasks.py
index 4cc91cd29..9f33d8c60 100644
--- a/wger/tasks.py
+++ b/wger/tasks.py
@@ -14,8 +14,25 @@
#
# You should have received a copy of the GNU Affero General Public License
-
+# Standard Library
+import ctypes # noqa E402
+import logging # noqa E402
+import os # noqa E402
+import socket # noqa E402
import sys
+import threading # noqa E402
+import time # noqa E402
+import webbrowser # noqa E402
+
+# Third Party
+import django # noqa E402
+from django.core.management import ( # noqa E402
+ call_command,
+ execute_from_command_line
+)
+from django.utils.crypto import get_random_string # noqa E402
+from invoke import task # noqa E402
+
#
# This is an ugly and terrible hack, please don't do this!
@@ -27,21 +44,6 @@ import sys
# is kind of OK to change the system path.
sys.path = sys.path[1:]
-import time # noqa E402
-import logging # noqa E402
-import threading # noqa E402
-import webbrowser # noqa E402
-import os # noqa E402
-import ctypes # noqa E402
-import socket # noqa E402
-from invoke import task # noqa E402
-
-import django # noqa E402
-from django.utils.crypto import get_random_string # noqa E402
-from django.core.management import ( # noqa E402
- call_command,
- execute_from_command_line
-)
logger = logging.getLogger(__name__)
diff --git a/wger/urls.py b/wger/urls.py
index c05c0b940..23e712bc7 100644
--- a/wger/urls.py
+++ b/wger/urls.py
@@ -15,35 +15,48 @@
# 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/>.
-from tastypie.api import Api
-from rest_framework import routers
-
+# Third Party
from django.conf import settings
-from django.conf.urls import include, url
+from django.conf.urls import (
+ include,
+ url
+)
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static
+from django.contrib import admin
from django.contrib.sitemaps.views import sitemap
+from rest_framework import routers
+from tastypie.api import Api
-from wger.nutrition.sitemap import NutritionSitemap
+# wger
+from wger.core.api import (
+ resources as core_api,
+ views as core_api_views
+)
+from wger.exercises.api import (
+ resources as exercises_api,
+ views as exercises_api_views
+)
from wger.exercises.sitemap import ExercisesSitemap
-
-from wger.utils.generic_views import TextTemplateView
-from wger.utils.generic_views import WebappManifestView
-
-from wger.exercises.api import resources as exercises_api
-from wger.nutrition.api import resources as nutrition_api
-from wger.manager.api import resources as manager_api
-from wger.core.api import resources as core_api
-from wger.weight.api import resources as weight_api
-
-from wger.manager.api import views as manager_api_views
-from wger.core.api import views as core_api_views
-from wger.exercises.api import views as exercises_api_views
-from wger.nutrition.api import views as nutrition_api_views
-from wger.weight.api import views as weight_api_views
+from wger.manager.api import (
+ resources as manager_api,
+ views as manager_api_views
+)
+from wger.nutrition.api import (
+ resources as nutrition_api,
+ views as nutrition_api_views
+)
+from wger.nutrition.sitemap import NutritionSitemap
+from wger.utils.generic_views import (
+ TextTemplateView,
+ WebappManifestView
+)
+from wger.weight.api import (
+ resources as weight_api,
+ views as weight_api_views
+)
-from django.contrib import admin
admin.autodiscover()
diff --git a/wger/utils/cache.py b/wger/utils/cache.py
index 9efcaeb3c..01b272e27 100644
--- a/wger/utils/cache.py
+++ b/wger/utils/cache.py
@@ -12,9 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
-import logging
+# Standard Library
import hashlib
+import logging
+# Third Party
from django.core.cache import cache
from django.utils.encoding import force_bytes
diff --git a/wger/utils/constants.py b/wger/utils/constants.py
index d62f01726..6f2407656 100644
--- a/wger/utils/constants.py
+++ b/wger/utils/constants.py
@@ -14,6 +14,7 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
from decimal import Decimal
diff --git a/wger/utils/context_processor.py b/wger/utils/context_processor.py
index 9ccad60b6..3d179af6b 100644
--- a/wger/utils/context_processor.py
+++ b/wger/utils/context_processor.py
@@ -13,9 +13,11 @@
# 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/>.
+# Third Party
from django.conf import settings
from django.templatetags.static import static
+# wger
from wger import get_version
from wger.config.models import GymConfig
from wger.utils import constants
diff --git a/wger/utils/fields.py b/wger/utils/fields.py
index ad5f3f4fe..7f6bbb71d 100644
--- a/wger/utils/fields.py
+++ b/wger/utils/fields.py
@@ -12,11 +12,18 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.db import models
-from wger.utils.widgets import Html5FormDateField, Html5FormTimeField
+# wger
+from wger.utils.widgets import (
+ Html5FormDateField,
+ Html5FormTimeField
+)
+
logger = logging.getLogger(__name__)
diff --git a/wger/utils/generic_views.py b/wger/utils/generic_views.py
index 777054855..3cad4eee8 100644
--- a/wger/utils/generic_views.py
+++ b/wger/utils/generic_views.py
@@ -14,22 +14,31 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-import bleach
-from django.utils.translation import ugettext_lazy
+# Third Party
+import bleach
from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
-from django.core.urlresolvers import reverse, reverse_lazy
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.http import (
+ HttpResponseForbidden,
+ HttpResponseRedirect
+)
from django.template.context_processors import csrf
-from django.views.generic.edit import ModelFormMixin
+from django.utils.translation import ugettext_lazy
from django.views.generic import TemplateView
-from django.http import HttpResponseRedirect, HttpResponseForbidden
+from django.views.generic.edit import ModelFormMixin
+# wger
from wger.utils.constants import (
- HTML_TAG_WHITELIST,
HTML_ATTRIBUTES_WHITELIST,
- HTML_STYLES_WHITELIST
+ HTML_STYLES_WHITELIST,
+ HTML_TAG_WHITELIST
)
diff --git a/wger/utils/helpers.py b/wger/utils/helpers.py
index ca65787f5..cb928b2ce 100644
--- a/wger/utils/helpers.py
+++ b/wger/utils/helpers.py
@@ -14,22 +14,27 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
+import datetime
+import decimal
+import json
+import logging
import os
import random
import string
-import logging
-import decimal
-import json
-import datetime
-
from functools import wraps
-from django.http import Http404
+# Third Party
from django.contrib.auth.models import User
from django.contrib.auth.tokens import default_token_generator
+from django.http import Http404
from django.shortcuts import get_object_or_404
from django.utils.encoding import force_bytes
-from django.utils.http import urlsafe_base64_decode, urlsafe_base64_encode
+from django.utils.http import (
+ urlsafe_base64_decode,
+ urlsafe_base64_encode
+)
+
logger = logging.getLogger(__name__)
diff --git a/wger/utils/language.py b/wger/utils/language.py
index 5a1f13efe..e14a15b43 100644
--- a/wger/utils/language.py
+++ b/wger/utils/language.py
@@ -12,14 +12,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
-from django.utils import translation
-from django.core.exceptions import ObjectDoesNotExist
+# Third Party
from django.core.cache import cache
-from wger.core.models import Language
+from django.core.exceptions import ObjectDoesNotExist
+from django.utils import translation
+# wger
from wger.config.models import LanguageConfig
+from wger.core.models import Language
from wger.utils.cache import cache_mapper
diff --git a/wger/utils/managers.py b/wger/utils/managers.py
index 4663154e3..3b2c8c08d 100644
--- a/wger/utils/managers.py
+++ b/wger/utils/managers.py
@@ -13,8 +13,11 @@
# 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/>.
+# Third Party
from django.db import models
from django.db.models.query import QuerySet
+
+# wger
from wger.utils.models import AbstractSubmissionModel
diff --git a/wger/utils/middleware.py b/wger/utils/middleware.py
index 9083f6ea5..a2ec858ff 100644
--- a/wger/utils/middleware.py
+++ b/wger/utils/middleware.py
@@ -16,13 +16,16 @@
Custom middleware
'''
+# Standard Library
import logging
+# Third Party
from django.conf import settings
from django.contrib import auth
-from django.utils.functional import SimpleLazyObject
from django.contrib.auth import login as django_login
+from django.utils.functional import SimpleLazyObject
+# wger
from wger.core.demo import create_temporary_user
diff --git a/wger/utils/models.py b/wger/utils/models.py
index 540e77586..c58d7b08c 100644
--- a/wger/utils/models.py
+++ b/wger/utils/models.py
@@ -14,9 +14,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.db import models
from django.utils.translation import ugettext_lazy as _
+# wger
from wger.core.models import License
diff --git a/wger/utils/pdf.py b/wger/utils/pdf.py
index f59011ba3..bb7925fb3 100644
--- a/wger/utils/pdf.py
+++ b/wger/utils/pdf.py
@@ -12,18 +12,23 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
from os.path import join as path_join
+# Third Party
from django.conf import settings
-from django.utils import translation
from django.core.exceptions import ObjectDoesNotExist
-
-from reportlab.lib.styles import ParagraphStyle, StyleSheet1
-from reportlab.pdfbase.ttfonts import TTFont
+from django.utils import translation
+from reportlab.lib.styles import (
+ ParagraphStyle,
+ StyleSheet1
+)
from reportlab.pdfbase import pdfmetrics
+from reportlab.pdfbase.ttfonts import TTFont
from reportlab.platypus import Paragraph
+# wger
from wger import get_version
from wger.core.models import Language
diff --git a/wger/utils/permissions.py b/wger/utils/permissions.py
index 731553f17..ada4c5695 100644
--- a/wger/utils/permissions.py
+++ b/wger/utils/permissions.py
@@ -15,6 +15,7 @@
# 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/>.
+# Third Party
from rest_framework import permissions
diff --git a/wger/utils/resources.py b/wger/utils/resources.py
index fd0bef570..607677ae9 100644
--- a/wger/utils/resources.py
+++ b/wger/utils/resources.py
@@ -12,10 +12,13 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from tastypie.authorization import ReadOnlyAuthorization
+
logger = logging.getLogger(__name__)
diff --git a/wger/utils/tests/test_capitalizer.py b/wger/utils/tests/test_capitalizer.py
index d04dfd3c2..2e5c5da6d 100644
--- a/wger/utils/tests/test_capitalizer.py
+++ b/wger/utils/tests/test_capitalizer.py
@@ -15,6 +15,7 @@
# You should have received a copy of the GNU Affero General Public License
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.utils.helpers import smart_capitalize
diff --git a/wger/utils/tests/test_check_access.py b/wger/utils/tests/test_check_access.py
index 375424af8..7dd10bcf6 100644
--- a/wger/utils/tests/test_check_access.py
+++ b/wger/utils/tests/test_check_access.py
@@ -12,9 +12,14 @@
#
# You should have received a copy of the GNU Affero General Public License
-from django.contrib.auth.models import User, AnonymousUser
+# Third Party
+from django.contrib.auth.models import (
+ AnonymousUser,
+ User
+)
from django.http import Http404
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.utils.helpers import check_access
diff --git a/wger/utils/tests/test_middleware.py b/wger/utils/tests/test_middleware.py
index 98e952edb..b45b3c4a6 100644
--- a/wger/utils/tests/test_middleware.py
+++ b/wger/utils/tests/test_middleware.py
@@ -12,8 +12,10 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
diff --git a/wger/utils/tests/test_unit_conversion.py b/wger/utils/tests/test_unit_conversion.py
index 4a4a65f62..c0145d043 100644
--- a/wger/utils/tests/test_unit_conversion.py
+++ b/wger/utils/tests/test_unit_conversion.py
@@ -12,8 +12,10 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
from decimal import Decimal
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.utils.constants import FOURPLACES
from wger.utils.units import AbstractWeight
diff --git a/wger/utils/tests/test_user_agents.py b/wger/utils/tests/test_user_agents.py
index df64ec327..e5dd3397a 100644
--- a/wger/utils/tests/test_user_agents.py
+++ b/wger/utils/tests/test_user_agents.py
@@ -13,8 +13,8 @@
# You should have received a copy of the GNU Affero General Public License
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
-
from wger.utils import user_agents
diff --git a/wger/utils/units.py b/wger/utils/units.py
index 3e46b87cd..e2f33afd4 100644
--- a/wger/utils/units.py
+++ b/wger/utils/units.py
@@ -12,9 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
from decimal import Decimal
+# wger
from wger.utils.constants import FOURPLACES
diff --git a/wger/utils/user_agents.py b/wger/utils/user_agents.py
index 5e303eb83..bbd54f59f 100644
--- a/wger/utils/user_agents.py
+++ b/wger/utils/user_agents.py
@@ -12,8 +12,10 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+
logger = logging.getLogger(__name__)
diff --git a/wger/utils/viewsets.py b/wger/utils/viewsets.py
index 2cc2584ce..6d005a980 100644
--- a/wger/utils/viewsets.py
+++ b/wger/utils/viewsets.py
@@ -15,7 +15,11 @@
# 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/>.
-from rest_framework import exceptions, viewsets
+# Third Party
+from rest_framework import (
+ exceptions,
+ viewsets
+)
class WgerOwnerObjectModelViewSet(viewsets.ModelViewSet):
diff --git a/wger/utils/widgets.py b/wger/utils/widgets.py
index 338b49894..37a67ea4a 100644
--- a/wger/utils/widgets.py
+++ b/wger/utils/widgets.py
@@ -9,29 +9,35 @@
#
# wger Workout Manager is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
+
+
+# Standard Library
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
+import logging
#
# You should have received a copy of the GNU Affero General Public License
import uuid
-import logging
from itertools import chain
+# Third Party
+from django.forms import fields
from django.forms.widgets import (
+ CheckboxChoiceInput,
CheckboxSelectMultiple,
+ ChoiceFieldRenderer,
DateInput,
Select,
SelectMultiple,
- TextInput,
- ChoiceFieldRenderer,
- CheckboxChoiceInput)
-
-from django.forms import fields
-
-from django.utils.translation import ugettext as _
+ TextInput
+)
from django.utils.encoding import force_text
-from django.utils.html import escape, conditional_escape
+from django.utils.html import (
+ conditional_escape,
+ escape
+)
from django.utils.safestring import mark_safe
+from django.utils.translation import ugettext as _
logger = logging.getLogger(__name__)
diff --git a/wger/weight/admin.py b/wger/weight/admin.py
index a99c0bb09..7f05ee077 100644
--- a/wger/weight/admin.py
+++ b/wger/weight/admin.py
@@ -12,9 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
-from wger.weight.models import WeightEntry
-
+# Third Party
from django.contrib import admin
+# wger
+from wger.weight.models import WeightEntry
+
admin.site.register(WeightEntry)
diff --git a/wger/weight/api/resources.py b/wger/weight/api/resources.py
index 5aca8c513..836c3cea6 100644
--- a/wger/weight/api/resources.py
+++ b/wger/weight/api/resources.py
@@ -14,12 +14,14 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from tastypie.authentication import ApiKeyAuthentication
-from tastypie.resources import ModelResource
from tastypie.constants import ALL
+from tastypie.resources import ModelResource
-from wger.weight.models import WeightEntry
+# wger
from wger.utils.resources import UserObjectsOnlyAuthorization
+from wger.weight.models import WeightEntry
class WeightEntryResource(ModelResource):
diff --git a/wger/weight/api/serializers.py b/wger/weight/api/serializers.py
index b38a82001..635ddeff6 100644
--- a/wger/weight/api/serializers.py
+++ b/wger/weight/api/serializers.py
@@ -15,8 +15,10 @@
# 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/>.
+# Third Party
from rest_framework import serializers
+# wger
from wger.weight.models import WeightEntry
diff --git a/wger/weight/api/views.py b/wger/weight/api/views.py
index ba46972eb..7c7d1a9dd 100644
--- a/wger/weight/api/views.py
+++ b/wger/weight/api/views.py
@@ -15,9 +15,11 @@
# 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/>.
+# Third Party
from rest_framework import viewsets
-from wger.weight.api.serializers import WeightEntrySerializer
+# wger
+from wger.weight.api.serializers import WeightEntrySerializer
from wger.weight.models import WeightEntry
diff --git a/wger/weight/forms.py b/wger/weight/forms.py
index 95a597e32..b3654f6dc 100644
--- a/wger/weight/forms.py
+++ b/wger/weight/forms.py
@@ -14,10 +14,19 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Third Party
from django import forms
-from django.forms import Form, CharField, Textarea, ModelForm, DateField, widgets
+from django.forms import (
+ CharField,
+ DateField,
+ Form,
+ ModelForm,
+ Textarea,
+ widgets
+)
from django.utils.translation import ugettext as _
+# wger
from wger.utils.constants import DATE_FORMATS
from wger.utils.widgets import Html5DateInput
from wger.weight.models import WeightEntry
diff --git a/wger/weight/helpers.py b/wger/weight/helpers.py
index 21fb5ded9..3baa8b2c4 100644
--- a/wger/weight/helpers.py
+++ b/wger/weight/helpers.py
@@ -14,21 +14,27 @@
#
# You should have received a copy of the GNU Affero General Public License
-import logging
-import six
+# Standard Library
+import csv
import datetime
import decimal
-import csv
import json
+import logging
from collections import OrderedDict
+# Third Party
+import six
from django.core.cache import cache
-from wger.utils.helpers import DecimalJsonEncoder
+# wger
+from wger.manager.models import (
+ WorkoutLog,
+ WorkoutSession
+)
from wger.utils.cache import cache_mapper
+from wger.utils.helpers import DecimalJsonEncoder
from wger.weight.models import WeightEntry
-from wger.manager.models import WorkoutSession
-from wger.manager.models import WorkoutLog
+
logger = logging.getLogger(__name__)
diff --git a/wger/weight/management/commands/email-weight-reminder.py b/wger/weight/management/commands/email-weight-reminder.py
index 6e840e352..19f605edb 100644
--- a/wger/weight/management/commands/email-weight-reminder.py
+++ b/wger/weight/management/commands/email-weight-reminder.py
@@ -14,16 +14,19 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
-from django.template import loader
-from django.core.management.base import BaseCommand
+# Third Party
+from django.conf import settings
+from django.contrib.sites.models import Site
from django.core import mail
-from django.utils.translation import ugettext_lazy as _
+from django.core.management.base import BaseCommand
+from django.template import loader
from django.utils import translation
-from django.conf import settings
+from django.utils.translation import ugettext_lazy as _
-from django.contrib.sites.models import Site
+# wger
from wger.core.models import UserProfile
from wger.weight.models import WeightEntry
diff --git a/wger/weight/models.py b/wger/weight/models.py
index abbc1cffe..42d9f7032 100644
--- a/wger/weight/models.py
+++ b/wger/weight/models.py
@@ -15,10 +15,13 @@
# 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/>.
-from django.db import models
-from django.core.validators import MinValueValidator, MaxValueValidator
-
+# Third Party
from django.contrib.auth.models import User
+from django.core.validators import (
+ MaxValueValidator,
+ MinValueValidator
+)
+from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
diff --git a/wger/weight/tests/test_csv_export.py b/wger/weight/tests/test_csv_export.py
index da6231e40..9703983ff 100644
--- a/wger/weight/tests/test_csv_export.py
+++ b/wger/weight/tests/test_csv_export.py
@@ -12,12 +12,16 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
+
logger = logging.getLogger(__name__)
diff --git a/wger/weight/tests/test_csv_import.py b/wger/weight/tests/test_csv_import.py
index 3237c3e6f..6eab7e99f 100644
--- a/wger/weight/tests/test_csv_import.py
+++ b/wger/weight/tests/test_csv_import.py
@@ -12,13 +12,17 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.weight.models import WeightEntry
+
logger = logging.getLogger(__name__)
diff --git a/wger/weight/tests/test_email_weight_reminder.py b/wger/weight/tests/test_email_weight_reminder.py
index 009387479..18b58ec76 100644
--- a/wger/weight/tests/test_email_weight_reminder.py
+++ b/wger/weight/tests/test_email_weight_reminder.py
@@ -12,12 +12,18 @@
#
# You should have received a copy of the GNU Affero General Public License
-from datetime import timedelta, datetime
+# Standard Library
+from datetime import (
+ datetime,
+ timedelta
+)
+# Third Party
from django.contrib.auth.models import User
from django.core import mail
from django.core.management import call_command
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
from wger.weight.models import WeightEntry
diff --git a/wger/weight/tests/test_entry.py b/wger/weight/tests/test_entry.py
index a9199a823..55b2b2513 100644
--- a/wger/weight/tests/test_entry.py
+++ b/wger/weight/tests/test_entry.py
@@ -12,14 +12,20 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import datetime
import decimal
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests import api_base_test
-from wger.core.tests.base_testcase import WorkoutManagerAddTestCase
-from wger.core.tests.base_testcase import WorkoutManagerEditTestCase, WorkoutManagerTestCase
+from wger.core.tests.base_testcase import (
+ WorkoutManagerAddTestCase,
+ WorkoutManagerEditTestCase,
+ WorkoutManagerTestCase
+)
from wger.utils.constants import TWOPLACES
from wger.weight.models import WeightEntry
diff --git a/wger/weight/tests/test_overview.py b/wger/weight/tests/test_overview.py
index f9a0712fb..48f3b3c19 100644
--- a/wger/weight/tests/test_overview.py
+++ b/wger/weight/tests/test_overview.py
@@ -12,12 +12,16 @@
#
# You should have received a copy of the GNU Affero General Public License
+# Standard Library
import logging
+# Third Party
from django.core.urlresolvers import reverse
+# wger
from wger.core.tests.base_testcase import WorkoutManagerTestCase
+
logger = logging.getLogger(__name__)
diff --git a/wger/weight/urls.py b/wger/weight/urls.py
index ae9abb393..3de3bfee0 100644
--- a/wger/weight/urls.py
+++ b/wger/weight/urls.py
@@ -15,11 +15,13 @@
# 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/>.
+# Third Party
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
-from wger.weight.forms import WeightCsvImportForm
+# wger
from wger.weight import views
+from wger.weight.forms import WeightCsvImportForm
urlpatterns = [
diff --git a/wger/weight/views.py b/wger/weight/views.py
index dbe5470d8..9813c6c34 100644
--- a/wger/weight/views.py
+++ b/wger/weight/views.py
@@ -14,33 +14,44 @@
#
# You should have received a copy of the GNU Affero General Public License
-import logging
+# Standard Library
import csv
import datetime
+import logging
-from django.shortcuts import render
-from django.http import HttpResponse
-from django.http import HttpResponseRedirect
-from django.core.urlresolvers import reverse
-from django.core.urlresolvers import reverse_lazy
+# Third Party
from django.contrib.auth.decorators import login_required
-from django.utils.translation import ugettext as _
-from django.utils.translation import ugettext_lazy
-from django.db.models import Min
-from django.db.models import Max
-from django.views.generic import CreateView
-from django.views.generic import UpdateView
-
-from rest_framework.response import Response
-from rest_framework.decorators import api_view
-
+from django.core.urlresolvers import (
+ reverse,
+ reverse_lazy
+)
+from django.db.models import (
+ Max,
+ Min
+)
+from django.http import (
+ HttpResponse,
+ HttpResponseRedirect
+)
+from django.shortcuts import render
+from django.utils.translation import (
+ ugettext as _,
+ ugettext_lazy
+)
+from django.views.generic import (
+ CreateView,
+ UpdateView
+)
from formtools.preview import FormPreview
+from rest_framework.decorators import api_view
+from rest_framework.response import Response
+# wger
+from wger.utils.generic_views import WgerFormMixin
+from wger.utils.helpers import check_access
+from wger.weight import helpers
from wger.weight.forms import WeightForm
from wger.weight.models import WeightEntry
-from wger.weight import helpers
-from wger.utils.helpers import check_access
-from wger.utils.generic_views import WgerFormMixin
logger = logging.getLogger(__name__)
diff --git a/wger/wsgi.py b/wger/wsgi.py
index 1531501da..1ec31d3d8 100644
--- a/wger/wsgi.py
+++ b/wger/wsgi.py
@@ -13,9 +13,13 @@ middleware here, or combine a Django application with an application of another
framework.
"""
+# Standard Library
import os
+
+# Third Party
from django.core.wsgi import get_wsgi_application
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
# This application object is used by any WSGI server configured to use this