Self hosted FLOSS fitness/workout, nutrition and weight tracker
Sorted imports
Peter van der Does736635b6b09d
diff --git a/manage.py b/manage.pyindex d5c1c05be..d55df6793 100644--- a/manage.py+++ b/manage.py@@ -1,13 +1,18 @@#!/usr/bin/env python++# Standard Libraryimport sys+# Third Partyfrom django.core.management import execute_from_command_line+# wgerfrom 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 settingsdiff --git a/setup.cfg b/setup.cfgindex 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=Falsediff --git a/setup.py b/setup.pyindex 1c10d52a7..153050d89 100644--- a/setup.py+++ b/setup.py@@ -7,10 +7,13 @@:license: GNU GPL, see LICENSE for more details."""+# Third Partyfrom setuptools import (- setup,- find_packages+ find_packages,+ setup)++# wgerfrom wger import get_versiondiff --git a/wger/__main__.py b/wger/__main__.pyindex 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 Libraryimport osimport sys++# Third Partyfrom invoke import run+'''This simple wrapper script is used as a console entry point in the packagedversion of the application. It simply redirects all arguments to the invokediff --git a/wger/config/apps.py b/wger/config/apps.pyindex 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 Partyfrom django.apps import AppConfigdiff --git a/wger/config/models.py b/wger/config/models.pyindex 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 Libraryimport logging+# Third Party+from django.core.cache import cachefrom django.db import modelsfrom django.utils.encoding import python_2_unicode_compatiblefrom 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.pyindex 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 Partyfrom django.db.models.signals import post_savefrom django.dispatch import receiver+# wgerfrom wger.config.models import LanguageConfigfrom wger.core.models import Languagediff --git a/wger/config/tests/test_custom_header.py b/wger/config/tests/test_custom_header.pyindex 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 Partyfrom django.core.urlresolvers import reverse-from wger.gym.models import Gym+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCase+from wger.gym.models import Gymclass GymNameHeaderTestCase(WorkoutManagerTestCase):diff --git a/wger/config/tests/test_gym_config.py b/wger/config/tests/test_gym_config.pyindex 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 Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+# wgerfrom wger.config.models import GymConfigfrom wger.core.models import UserProfilefrom 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.pyindex 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/>.+# wgerfrom wger.config.models import LanguageConfig-from wger.core.tests.base_testcase import WorkoutManagerEditTestCasediff --git a/wger/config/urls.py b/wger/config/urls.pyindex 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 configsdiff --git a/wger/config/views/gym_config.py b/wger/config/views/gym_config.pyindex 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 Libraryimport 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+# wgerfrom wger.config.models import GymConfigfrom wger.utils.generic_views import WgerFormMixindiff --git a/wger/config/views/language_config.py b/wger/config/views/language_config.pyindex 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 Libraryimport 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+# wgerfrom wger.config.models import LanguageConfigfrom wger.utils.generic_views import WgerFormMixindiff --git a/wger/core/api/resources.py b/wger/core/api/resources.pyindex 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 Partyfrom tastypie.authentication import ApiKeyAuthenticationfrom tastypie.constants import ALLfrom tastypie.resources import ModelResource-from wger.utils.resources import UserObjectsOnlyAuthorization+# wgerfrom wger.core.models import (- UserProfile,- Language,DaysOfWeek,- License+ Language,+ License,+ UserProfile)+from wger.utils.resources import UserObjectsOnlyAuthorizationclass UserProfileResource(ModelResource):diff --git a/wger/core/api/serializers.py b/wger/core/api/serializers.pyindex 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 Partyfrom rest_framework import serializers+# wgerfrom 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.pyindex 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 Partyfrom django.contrib.auth.models import Userfrom rest_framework import viewsets-from rest_framework.response import Responsefrom rest_framework.decorators import detail_route+from rest_framework.response import Response-from wger.core.models import (- UserProfile,- Language,- DaysOfWeek,- License,- RepetitionUnit,- WeightUnit)+# wgerfrom 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.pyindex 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 Partyfrom django.apps import AppConfigdiff --git a/wger/core/demo.py b/wger/core/demo.pyindex 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 datetimeimport loggingimport random-import datetimeimport uuid-from django.contrib.auth.models import User+# Third Partyfrom django.contrib.auth import authenticate+from django.contrib.auth.models import Userfrom django.utils.translation import ugettext as _-from wger.weight.models import WeightEntry-from wger.exercises.models import Exercise+# wgerfrom wger.core.models import DaysOfWeek+from wger.exercises.models import Exercisefrom 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.pyindex 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 Partyfrom 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 Userfrom django.core.exceptions import ValidationError-from django import formsfrom django.forms import (+ CharField,EmailField,Form,- CharField,- widgets,- PasswordInput+ PasswordInput,+ widgets)from django.utils.translation import ugettext as _++# wgerfrom wger.core.models import UserProfilediff --git a/wger/core/management/commands/clear-cache.py b/wger/core/management/commands/clear-cache.pyindex 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 Partyfrom django.contrib.auth.models import User-from django.core.management.base import BaseCommand, CommandErrorfrom django.core.cache import cache+from django.core.management.base import (+ BaseCommand,+ CommandError+)+# wgerfrom 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.pyindex 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 Libraryimport datetime-from django.utils.timezone import now+# Third Partyfrom django.core.management.base import BaseCommand+from django.utils.timezone import now++# wgerfrom wger.core.models import UserProfilediff --git a/wger/core/management/commands/extract-i18n.py b/wger/core/management/commands/extract-i18n.pyindex 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 Partyfrom django.core.management.base import BaseCommand+# wgerfrom wger.core.models import RepetitionUnitfrom 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.pyindex 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 Partyfrom django.contrib.auth.models import Userfrom django.core.management.base import BaseCommand+# wgerfrom wger.gym.helpers import get_user_last_activitydiff --git a/wger/core/models.py b/wger/core/models.pyindex 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 Libraryimport datetimeimport decimal-from django.db import models-from django.db.models import IntegerField+# Third Partyfrom django.contrib.auth.models import User-from django.core.urlresolvers import reversefrom 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 IntegerFieldfrom django.utils.encoding import python_2_unicode_compatiblefrom django.utils.translation import ugettext_lazy as _-from wger.gym.models import Gym+# wger+from wger.gym.models import Gymfrom wger.utils.constants import TWOPLACESfrom wger.utils.units import AbstractWeight-from wger.weight.models import WeightEntrydiff --git a/wger/core/signals.py b/wger/core/signals.pyindex 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 Partyfrom django.contrib.auth.models import Userfrom 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_loaddatadiff --git a/wger/core/templatetags/wger_extras.py b/wger/core/templatetags/wger_extras.pyindex 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 Partyfrom django import templatefrom django.conf import settingsfrom django.forms.widgets import (@@ -22,19 +23,21 @@ from django.forms.widgets import ()from django.utils.safestring import mark_safefrom django.utils.translation import (- ugettext_lazy as _,- pgettext+ pgettext,+ ugettext_lazy as _)+# wgerfrom 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.pyindex 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 Partyfrom django.contrib.auth.models import Userfrom rest_framework import statusfrom rest_framework.test import APITestCase+# wgerfrom wger.core.tests.base_testcase import BaseTestCasediff --git a/wger/core/tests/base_testcase.py b/wger/core/tests/base_testcase.pyindex 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 Libraryimport decimalimport logging-import tempfile+import osimport shutil+import tempfile-from django.core.urlresolvers import reverse-from django.core.urlresolvers import NoReverseMatch-from django.core.cache import cache+# Third Party+import sixfrom django.conf import settings+from django.core.cache import cache+from django.core.urlresolvers import (+ NoReverseMatch,+ reverse+)from django.test import TestCase++# wgerfrom wger.utils.constants import TWOPLACESdiff --git a/wger/core/tests/test_apikey.py b/wger/core/tests/test_apikey.pyindex 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 Libraryimport logging+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reversefrom rest_framework.authtoken.models import Token+# wgerfrom 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.pyindex 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 Libraryimport logging+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+# wgerfrom 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.pyindex 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/>.+# wgerfrom wger.core.models import DaysOfWeekfrom wger.core.tests import api_base_testfrom wger.core.tests.base_testcase import WorkoutManagerTestCasediff --git a/wger/core/tests/test_delete_user.py b/wger/core/tests/test_delete_user.pyindex 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 Libraryimport logging+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+# wgerfrom 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.pyindex 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 Partyfrom django.core import mailfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasediff --git a/wger/core/tests/test_index.py b/wger/core/tests/test_index.pyindex 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 Partyfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.manager.models import Workoutfrom wger.nutrition.models import NutritionPlandiff --git a/wger/core/tests/test_language.py b/wger/core/tests/test_language.pyindex 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 Partyfrom django.core.urlresolvers import reverse_lazy+# wgerfrom wger.core.models import Languagefrom 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.pyindex 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/>.+# wgerfrom wger.core.models import Licensefrom 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.pyindex 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 Libraryimport datetimeimport decimalimport logging+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.utils.constants import TWOPLACESfrom wger.weight.models import WeightEntry+logger = logging.getLogger(__name__)diff --git a/wger/core/tests/test_registration.py b/wger/core/tests/test_registration.pyindex 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 Libraryimport logging+# Third Partyfrom django.contrib.auth.models import Userfrom 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.pyindex 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/>.+# wgerfrom wger.core.models import RepetitionUnitfrom 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.pyindex 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 Partyimport sixfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.models import Languagefrom wger.core.tests.base_testcase import WorkoutManagerTestCasediff --git a/wger/core/tests/test_sitemap.py b/wger/core/tests/test_sitemap.pyindex 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 Partyfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasediff --git a/wger/core/tests/test_spaceless.py b/wger/core/tests/test_spaceless.pyindex 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 Libraryimport logging-from django.template import Template, Context+# Third Party+from django.template import (+ Context,+ Template+)+# wgerfrom 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.pyindex 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 Libraryimport datetimeimport random+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.management import call_commandfrom 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 WeightEntrydiff --git a/wger/core/tests/test_user.py b/wger/core/tests/test_user.pyindex 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 Partyfrom django.contrib.auth.models import User-from django.core.urlresolvers import reverse, reverse_lazy+from django.core.urlresolvers import (+ reverse,+ reverse_lazy+)+# wgerfrom 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.pyindex 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/>.+# wgerfrom wger.core.models import WeightUnitfrom 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.pyindex 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 Partyfrom django.conf.urls import (- url,- include+ include,+ url)-from django.views.generic import TemplateViewfrom django.contrib.auth import viewsfrom django.core.urlresolvers import reverse_lazy+from django.views.generic import TemplateView+# wgerfrom wger.core.views import (- user,- misc,- license,languages,+ license,+ misc,repetition_units,+ user,weight_units)+# sub patterns for languagespatterns_language = [url(r'^list$',diff --git a/wger/core/views/languages.py b/wger/core/views/languages.pyindex 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 Libraryimport 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)+# wgerfrom wger.core.models import Languagefrom wger.utils.generic_views import (WgerDeleteMixin,diff --git a/wger/core/views/license.py b/wger/core/views/license.pyindex 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 Libraryimport 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 Licensefrom 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.pyindex 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 Libraryimport logging+# Third Partyfrom 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 TemplateViewfrom django.contrib import messages-from django.contrib.auth.decorators import login_requiredfrom 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 renderfrom 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 DaysOfWeekfrom wger.manager.models import Schedulefrom wger.nutrition.models import NutritionPlan-from wger.weight.models import WeightEntryfrom wger.weight.helpers import get_last_entries+from wger.weight.models import WeightEntrylogger = logging.getLogger(__name__)diff --git a/wger/core/views/repetition_units.py b/wger/core/views/repetition_units.pyindex 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 Libraryimport 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_lazyfrom 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 RepetitionUnitfrom wger.utils.generic_views import (- WgerFormMixin,- WgerDeleteMixin+ WgerDeleteMixin,+ WgerFormMixin)-from wger.core.models import RepetitionUnitlogger = logging.getLogger(__name__)diff --git a/wger/core/views/user.py b/wger/core/views/user.pyindex 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 Libraryimport 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 Userfrom 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 settingsfrom 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 GymConfigfrom 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 profilediff --git a/wger/core/views/weight_units.py b/wger/core/views/weight_units.pyindex 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 Libraryimport 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_lazyfrom 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 WeightUnitfrom wger.utils.generic_views import (- WgerFormMixin,- WgerDeleteMixin+ WgerDeleteMixin,+ WgerFormMixin)-from wger.core.models import WeightUnitlogger = logging.getLogger(__name__)diff --git a/wger/email/apps.py b/wger/email/apps.pyindex 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 Partyfrom django.apps import AppConfigdiff --git a/wger/email/forms.py b/wger/email/forms.pyindex 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 Partyfrom django.forms import (- Form,CharField,+ Form,Textarea)+from django.utils.translation import pgettextclass EmailListForm(Form):diff --git a/wger/email/management/commands/send-mass-emails.py b/wger/email/management/commands/send-mass-emails.pyindex 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 Partyfrom django.conf import settings-+from django.core import mailfrom django.core.management.base import BaseCommand++# wgerfrom wger.email.models import CronEntrydiff --git a/wger/email/models.py b/wger/email/models.pyindex 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 Partyfrom django.contrib.auth.models import Userfrom django.db import models+# wgerfrom wger.gym.models import Gymdiff --git a/wger/email/tests/test_gym_emails.py b/wger/email/tests/test_gym_emails.pyindex 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 Partyfrom django.core.urlresolvers import reverse-from wger.core.tests.base_testcase import (- WorkoutManagerAccessTestCase,-)+# wger+from wger.core.tests.base_testcase import WorkoutManagerAccessTestCaseclass AccessContractTestCase(WorkoutManagerAccessTestCase):diff --git a/wger/email/urls.py b/wger/email/urls.pyindex 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+)+# wgerfrom wger.email.forms import EmailListFormfrom wger.email.views import gymdiff --git a/wger/email/views/gym.py b/wger/email/views/gym.pyindex 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 Partyfrom django.conf import settings-from django.http import HttpResponseRedirect, HttpResponseForbidden+from django.contrib.auth.mixins import PermissionRequiredMixinfrom django.core import mailfrom django.core.urlresolvers import reverse+from django.http import (+ HttpResponseForbidden,+ HttpResponseRedirect+)from django.shortcuts import get_object_or_404from 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, Logclass EmailLogListView(PermissionRequiredMixin, generic.ListView):diff --git a/wger/exercises/admin.py b/wger/exercises/admin.pyindex 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 Partyfrom 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.StackedInlinediff --git a/wger/exercises/api/resources.py b/wger/exercises/api/resources.pyindex 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 Partyfrom easy_thumbnails.alias import aliasesfrom 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.pyindex 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 Partyfrom rest_framework import serializers++# wgerfrom 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.pyindex 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_thumbnailerfrom rest_framework import viewsets+from rest_framework.decorators import (+ api_view,+ detail_route+)from rest_framework.permissions import IsAuthenticatedOrReadOnlyfrom 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 _+# wgerfrom wger.config.models import LanguageConfigfrom 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 CreateOnlyPermissiondiff --git a/wger/exercises/apps.py b/wger/exercises/apps.pyindex 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 Partyfrom django.apps import AppConfigdiff --git a/wger/exercises/forms.py b/wger/exercises/forms.pyindex 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 Partyfrom 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.pyindex 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 Libraryimport 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 Filefrom 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.pyindex 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 Partyfrom django.core.management.base import BaseCommand+# wgerfrom wger.exercises.models import Exercisefrom wger.utils.helpers import smart_capitalizediff --git a/wger/exercises/management/commands/submitted-exercises.py b/wger/exercises/management/commands/submitted-exercises.pyindex 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 Partyfrom django.core.management.base import BaseCommand++# wgerfrom wger.exercises.models import Exercisediff --git a/wger/exercises/models.py b/wger/exercises/models.pyindex 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 Libraryimport 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 settingsfrom django.contrib.auth.models import Userfrom 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 reversefrom django.core import mailfrom django.core.cache import cache+from django.core.urlresolvers import reversefrom 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 _+# wgerfrom wger.core.models import Language-from wger.utils.helpers import smart_capitalize-from wger.utils.managers import SubmissionManager-from wger.utils.models import AbstractLicenseModel, AbstractSubmissionModelfrom 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.pyindex 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 receiverfrom easy_thumbnails.files import get_thumbnailerfrom easy_thumbnails.signal_handlers import generate_aliasesfrom easy_thumbnails.signals import saved_file+# wgerfrom wger.exercises.models import ExerciseImagediff --git a/wger/exercises/sitemap.py b/wger/exercises/sitemap.pyindex 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 Partyfrom django.contrib.sitemaps import Sitemap++# wger+from wger.config.models import LanguageConfigfrom wger.exercises.models import Exercisefrom wger.utils.language import load_item_languages-from wger.config.models import LanguageConfigclass ExercisesSitemap(Sitemap):diff --git a/wger/exercises/tests/test_categories.py b/wger/exercises/tests/test_categories.pyindex 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 Partyfrom django.core.cache import cachefrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests import api_base_testfrom wger.core.tests.base_testcase import (+ WorkoutManagerAccessTestCase,+ WorkoutManagerAddTestCase,WorkoutManagerDeleteTestCase,- WorkoutManagerTestCase,WorkoutManagerEditTestCase,- WorkoutManagerAddTestCase,- WorkoutManagerAccessTestCase)+ WorkoutManagerTestCase+)from wger.exercises.models import ExerciseCategoryfrom wger.utils.cache import get_template_cache_namediff --git a/wger/exercises/tests/test_corrected_exercise.py b/wger/exercises/tests/test_corrected_exercise.pyindex 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 Partyfrom django.core import mailfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.exercises.models import Exercisediff --git a/wger/exercises/tests/test_equipment.py b/wger/exercises/tests/test_equipment.pyindex 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 Partyfrom django.core.cache import cachefrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests import api_base_testfrom 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, Exercisefrom wger.utils.cache import get_template_cache_namefrom wger.utils.constants import PAGINATION_OBJECTS_PER_PAGEdiff --git a/wger/exercises/tests/test_exercise.py b/wger/exercises/tests/test_exercise.pyindex 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 Libraryimport json+# Third Partyfrom django.core import mailfrom django.core.cache import cachefrom django.core.urlresolvers import reverse+# wgerfrom 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_mapperclass ExerciseRepresentationTestCase(WorkoutManagerTestCase):diff --git a/wger/exercises/tests/test_exercise_comments.py b/wger/exercises/tests/test_exercise_comments.pyindex 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 Partyfrom django.core.cache import cachefrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests import api_base_testfrom wger.core.tests.base_testcase import (- WorkoutManagerTestCase,+ WorkoutManagerAddTestCase,WorkoutManagerEditTestCase,- WorkoutManagerAddTestCase+ WorkoutManagerTestCase+)+from wger.exercises.models import (+ Exercise,+ ExerciseComment)-from wger.exercises.models import Exercise, ExerciseCommentfrom wger.utils.cache import cache_mapperdiff --git a/wger/exercises/tests/test_exercise_images.py b/wger/exercises/tests/test_exercise_images.pyindex 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 Partyfrom django.core.files import Filefrom django.core.urlresolvers import reverse+# wgerfrom 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, ExerciseImageclass MainImageTestCase(WorkoutManagerTestCase):diff --git a/wger/exercises/tests/test_muscles.py b/wger/exercises/tests/test_muscles.pyindex 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 Partyfrom django.core.cache import cachefrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests import api_base_testfrom wger.core.tests.base_testcase import (- WorkoutManagerTestCase,+ WorkoutManagerAccessTestCase,+ WorkoutManagerAddTestCase,WorkoutManagerDeleteTestCase,WorkoutManagerEditTestCase,- WorkoutManagerAddTestCase,- WorkoutManagerAccessTestCase)+ WorkoutManagerTestCase+)from wger.exercises.models import Musclefrom wger.utils.cache import get_template_cache_namediff --git a/wger/exercises/tests/test_submitted_exercise.py b/wger/exercises/tests/test_submitted_exercise.pyindex 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 Partyfrom django.core import mailfrom 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 Exercisediff --git a/wger/exercises/tests/test_submitted_image.py b/wger/exercises/tests/test_submitted_image.pyindex 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 Partyfrom django.core import mailfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.exercises.models import ExerciseImagediff --git a/wger/exercises/urls.py b/wger/exercises/urls.pyindex 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+# wgerfrom 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.pyindex 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+)+# wgerfrom wger.exercises.models import ExerciseCategory-from wger.utils.generic_views import (- WgerFormMixin,- WgerDeleteMixin+ WgerDeleteMixin,+ WgerFormMixin)from wger.utils.language import load_languagediff --git a/wger/exercises/views/comments.py b/wger/exercises/views/comments.pyindex 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 Libraryimport 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 Partyfrom 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_404from django.utils.translation import ugettext_lazy+from django.views.generic import (+ CreateView,+ UpdateView+)-from django.views.generic import CreateView, UpdateView-+# wgerfrom 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 WgerFormMixindiff --git a/wger/exercises/views/equipment.py b/wger/exercises/views/equipment.pyindex 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)++# wgerfrom wger.config.models import LanguageConfigfrom wger.exercises.models import Equipment+from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGEfrom wger.utils.generic_views import (- WgerFormMixin,- WgerDeleteMixin+ WgerDeleteMixin,+ WgerFormMixin)-from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGEfrom wger.utils.language import load_item_languagesdiff --git a/wger/exercises/views/exercises.py b/wger/exercises/views/exercises.pyindex 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 Licenseimport 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 LanguageConfigfrom wger.exercises.models import (Exercise,- Muscle,- ExerciseCategory+ ExerciseCategory,+ Muscle)+from wger.manager.models import WorkoutLog+from wger.utils.cache import cache_mapperfrom 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_mapperfrom wger.utils.widgets import (+ TranslatedOriginalSelectMultiple,TranslatedSelect,- TranslatedSelectMultiple,- TranslatedOriginalSelectMultiple+ TranslatedSelectMultiple)-from wger.config.models import LanguageConfigfrom wger.weight.helpers import process_log_entriesdiff --git a/wger/exercises/views/images.py b/wger/exercises/views/images.pyindex 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 Libraryimport logging+# Third Partyfrom 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 reversefrom django.http import HttpResponseRedirectfrom 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+# wgerfrom 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.pyindex 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 LanguageConfigfrom wger.exercises.models import Musclefrom 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.pyindex 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 Partyfrom django.apps import AppConfigdiff --git a/wger/gym/forms.py b/wger/gym/forms.pyindex 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 Partyfrom django import forms+from django.contrib.auth.models import Userfrom django.utils.translation import ugettext as _+# wgerfrom wger.core.forms import UserPersonalInformationFormfrom wger.utils.widgets import BootstrapSelectMultiplediff --git a/wger/gym/helpers.py b/wger/gym/helpers.pyindex 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.pyindex 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 Partyfrom django.contrib.auth.models import Userfrom django.core.exceptions import ObjectDoesNotExistfrom django.core.management.base import BaseCommand+# wgerfrom 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.pyindex 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 Libraryimport datetime+# Third Party+from django.conf import settingsfrom django.core import mail-from django.utils import translation-from django.utils.translation import ugettext as _from django.core.management.base import BaseCommandfrom django.template.loader import render_to_string-from django.conf import settings+from django.utils import translation+from django.utils.translation import ugettext as _+# wgerfrom wger.gym.helpers import is_any_gym_adminfrom wger.gym.models import Gymdiff --git a/wger/gym/managers.py b/wger/gym/managers.pyindex 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 Partyfrom django.contrib.auth.models import (Permission,User)+from django.db import models+from django.db.models import Qclass GymManager(models.Manager):diff --git a/wger/gym/models.py b/wger/gym/models.pyindex 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 Libraryimport datetime+import uuid-from django.db import models as m+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+from django.db import models as mfrom 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 _+)+# wgerfrom wger.gym.managers import GymManagerdiff --git a/wger/gym/signals.py b/wger/gym/signals.pyindex 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+# wgerfrom wger.gym.models import (Gym,GymConfig,diff --git a/wger/gym/tests/test_admin_config.py b/wger/gym/tests/test_admin_config.pyindex 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+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerEditTestCase-from wger.gym.models import GymAdminConfigdiff --git a/wger/gym/tests/test_admin_user_notes.py b/wger/gym/tests/test_admin_user_notes.pyindex 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 Partyfrom 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 AdminUserNotediff --git a/wger/gym/tests/test_config.py b/wger/gym/tests/test_config.pyindex 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/>.+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerEditTestCasefrom wger.gym.models import GymConfigdiff --git a/wger/gym/tests/test_contract_options.py b/wger/gym/tests/test_contract_options.pyindex 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 Partyfrom django.core.urlresolvers import reverse+# wgerfrom 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 ContractOptiondiff --git a/wger/gym/tests/test_contract_types.py b/wger/gym/tests/test_contract_types.pyindex 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 Partyfrom django.core.urlresolvers import reverse+# wgerfrom 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 ContractTypediff --git a/wger/gym/tests/test_contracts.py b/wger/gym/tests/test_contracts.pyindex 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 Partyfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import (WorkoutManagerAccessTestCase,- WorkoutManagerEditTestCase,WorkoutManagerAddTestCase,+ WorkoutManagerEditTestCase)from wger.gym.models import Contractdiff --git a/wger/gym/tests/test_export.py b/wger/gym/tests/test_export.pyindex 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 Libraryimport datetime+# Third Partyfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.gym.models import Gymdiff --git a/wger/gym/tests/test_gym.py b/wger/gym/tests/test_gym.pyindex 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 Partyfrom django.core.urlresolvers import reverse_lazy+# wgerfrom 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 Gymdiff --git a/wger/gym/tests/test_inactive_members.py b/wger/gym/tests/test_inactive_members.pyindex 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 Partyfrom django.core import mailfrom django.core.management import call_command+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasediff --git a/wger/gym/tests/test_user.py b/wger/gym/tests/test_user.pyindex 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 Libraryimport 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 ContentTypefrom django.core.urlresolvers import reverse+# wgerfrom wger.core.models import UserProfilefrom 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.pyindex 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+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerEditTestCase-from wger.gym.models import GymUserConfigdiff --git a/wger/gym/tests/test_user_documents.py b/wger/gym/tests/test_user_documents.pyindex 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 Partyfrom 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 UserDocumentdiff --git a/wger/gym/tests/test_user_last_activity.py b/wger/gym/tests/test_user_last_activity.pyindex 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 Libraryimport datetime+# Third Partyfrom django.contrib.auth.models import User+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom 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.pyindex 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 Partyfrom django.conf.urls import (- url,- include+ include,+ url)+# wgerfrom 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.pyindex 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 Libraryimport logging+# Third Partyfrom django.core.urlresolvers import reversefrom django.utils.translation import ugettext as _from django.views.generic import UpdateView+# wgerfrom wger.gym.models import GymAdminConfigfrom wger.utils.generic_views import WgerFormMixindiff --git a/wger/gym/views/admin_notes.py b/wger/gym/views/admin_notes.pyindex 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 Libraryimport 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 reversefrom 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)+# wgerfrom wger.gym.models import AdminUserNotefrom wger.utils.generic_views import (- WgerFormMixin,- WgerDeleteMixin+ WgerDeleteMixin,+ WgerFormMixin)diff --git a/wger/gym/views/config.py b/wger/gym/views/config.pyindex 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 Libraryimport logging-from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin+# Third Party+from django.contrib.auth.mixins import (+ LoginRequiredMixin,+ PermissionRequiredMixin+)from django.core.urlresolvers import reversefrom django.http.response import HttpResponseForbiddenfrom django.utils.translation import ugettext as _from django.views.generic import UpdateView+# wgerfrom wger.gym.models import GymConfigfrom wger.utils.generic_views import WgerFormMixindiff --git a/wger/gym/views/contract.py b/wger/gym/views/contract.pyindex 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 Libraryimport 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 reversefrom django.http.response import HttpResponseForbiddenfrom 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+# wgerfrom 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.pyindex 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 Libraryimport logging-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin+# Third Party+from django.contrib.auth.mixins import (+ LoginRequiredMixin,+ PermissionRequiredMixin+)from django.core.urlresolvers import reversefrom django.http.response import HttpResponseForbiddenfrom 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.pyindex 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 Libraryimport logging-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin+# Third Party+from django.contrib.auth.mixins import (+ LoginRequiredMixin,+ PermissionRequiredMixin+)from django.core.urlresolvers import reversefrom django.http.response import HttpResponseForbiddenfrom 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.pyindex 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 Libraryimport 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 reversefrom 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 UserDocumentfrom wger.utils.generic_views import (- WgerFormMixin,- WgerDeleteMixin+ WgerDeleteMixin,+ WgerFormMixin)-from wger.gym.models import UserDocumentlogger = logging.getLogger(__name__)diff --git a/wger/gym/views/export.py b/wger/gym/views/export.pyindex 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 Libraryimport csvimport datetimeimport logging+# Third Partyfrom django.contrib.auth.decorators import login_requiredfrom django.http.response import (- HttpResponseForbidden,- HttpResponse+ HttpResponse,+ HttpResponseForbidden)from django.shortcuts import get_object_or_404from django.utils.translation import ugettext as _+# wgerfrom wger.gym.models import Gym+logger = logging.getLogger(__name__)diff --git a/wger/gym/views/gym.py b/wger/gym/views/gym.pyindex 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 Licenseimport csv+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.import datetimeimport logging-from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin+# Third Partyfrom 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 GlobalGymConfigfrom wger.utils.generic_views import (- WgerFormMixin,WgerDeleteMixin,- WgerMultiplePermissionRequiredMixin)+ WgerFormMixin,+ WgerMultiplePermissionRequiredMixin+)from wger.utils.helpers import password_generatordiff --git a/wger/gym/views/user_config.py b/wger/gym/views/user_config.pyindex 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 Libraryimport logging-from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin+# Third Party+from django.contrib.auth.mixins import (+ LoginRequiredMixin,+ PermissionRequiredMixin+)from django.core.urlresolvers import reversefrom django.http import HttpResponseForbiddenfrom django.utils.translation import ugettext as _from django.views.generic import UpdateView+# wgerfrom wger.gym.models import GymUserConfigfrom wger.utils.generic_views import WgerFormMixindiff --git a/wger/manager/admin.py b/wger/manager/admin.pyindex 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 UserProfilefrom wger.manager import models as manager_models-from django.contrib import adminadmin.site.register(manager_models.Workout)admin.site.register(manager_models.Set)diff --git a/wger/manager/api/resources.py b/wger/manager/api/resources.pyindex 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 Partyfrom tastypie import fieldsfrom 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+# wgerfrom wger.core.api.resources import DaysOfWeekResourcefrom wger.exercises.api.resources import ExerciseResource-from wger.utils.resources import UserObjectsOnlyAuthorizationfrom wger.manager.models import (- WorkoutSession,- Workout,+ Day,Schedule,ScheduleStep,- Day,Set,Setting,- WorkoutLog+ Workout,+ WorkoutLog,+ WorkoutSession)+from wger.utils.resources import UserObjectsOnlyAuthorizationclass WorkoutResource(ModelResource):diff --git a/wger/manager/api/serializers.py b/wger/manager/api/serializers.pyindex 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 Partyfrom rest_framework import serializers+# wgerfrom 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.pyindex 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 Libraryimport datetime+# Third Partyfrom rest_framework import viewsets-from rest_framework.response import Responsefrom rest_framework.decorators import detail_route+from rest_framework.response import Response+# wgerfrom 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.pyindex 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 Partyfrom django.apps import AppConfigdiff --git a/wger/manager/forms.py b/wger/manager/forms.pyindex 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 Partyfrom 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 _+# wgerfrom 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_FORMATSfrom wger.utils.widgets import (- TranslatedSelectMultiple,+ ExerciseAjaxSelect,+ Html5DateInput,TranslatedSelect,- ExerciseAjaxSelect+ TranslatedSelectMultiple)-from wger.utils.constants import DATE_FORMATS-from wger.utils.widgets import Html5DateInputclass DemoUserForm(Form):diff --git a/wger/manager/helpers.py b/wger/manager/helpers.pyindex 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 Libraryimport datetimefrom calendar import HTMLCalendar+# Third Party+from django.core.urlresolvers import reverse+from django.utils.translation import ugettext as _from reportlab.lib import colorsfrom reportlab.lib.units import cmfrom 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 _+# wgerfrom wger.utils.helpers import normalize_decimal-from wger.utils.pdf import styleSheetdiff --git a/wger/manager/management/commands/email-reminders.py b/wger/manager/management/commands/email-reminders.pyindex 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 Libraryimport 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 Sitefrom django.core import mail-from django.utils.translation import ugettext_lazy as _+from django.core.management.base import BaseCommand+from django.template import loaderfrom django.utils import translation-from django.conf import settings+from django.utils.translation import ugettext_lazy as _-from django.contrib.sites.models import Site+# wgerfrom wger.core.models import UserProfilefrom wger.manager.models import Schedulediff --git a/wger/manager/models.py b/wger/manager/models.pyindex 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 Libraryimport datetimeimport logging-from django.utils.encoding import python_2_unicode_compatible+# Third Partyimport 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 ValidationErrorfrom 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 Exercisefrom wger.manager.helpers import reps_smart_textfrom wger.utils.cache import (diff --git a/wger/manager/signals.py b/wger/manager/signals.pyindex 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 Partyfrom 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+)+# wgerfrom 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_cachediff --git a/wger/manager/tests/test_copy_workout.py b/wger/manager/tests/test_copy_workout.pyindex 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 Libraryimport logging+# Third Partyfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.models import UserProfilefrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.manager.models import Workout+logger = logging.getLogger(__name__)diff --git a/wger/manager/tests/test_day.py b/wger/manager/tests/test_day.pyindex 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 Partyfrom django.core.cache import cachefrom 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 Dayfrom wger.utils.cache import cache_mapperdiff --git a/wger/manager/tests/test_email_reminder.py b/wger/manager/tests/test_email_reminder.pyindex 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 Libraryimport datetime+# Third Partyfrom django.contrib.auth.models import Userfrom django.core import mailfrom django.core.management import call_command+# wgerfrom wger.core.models import UserProfilefrom 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.pyindex 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 Libraryimport datetime+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+# wgerfrom 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 librarydiff --git a/wger/manager/tests/test_pdf.py b/wger/manager/tests/test_pdf.pyindex 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 Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.utils.helpers import make_tokendiff --git a/wger/manager/tests/test_schedule.py b/wger/manager/tests/test_schedule.pyindex 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 Libraryimport datetimeimport logging+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+# wgerfrom 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.pyindex 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 Libraryimport datetime+# Third Partyfrom django.core.urlresolvers import reverse_lazy+# wgerfrom 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 ScheduleStepdiff --git a/wger/manager/tests/test_set.py b/wger/manager/tests/test_set.pyindex 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 Libraryimport logging+# Third Partyfrom 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+)+# wgerfrom 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_mapperdiff --git a/wger/manager/tests/test_timer.py b/wger/manager/tests/test_timer.pyindex 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 Libraryimport datetimeimport loggingimport mathfrom decimal import Decimal+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom 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.pyindex 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 Libraryimport datetimeimport logging+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.cache import cache-from django.core.urlresolvers import reverse, reverse_lazy+from django.core.urlresolvers import (+ reverse,+ reverse_lazy+)+# wgerfrom 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.pyindex 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 Libraryimport datetime+# Third Partyfrom django.core.urlresolvers import reverse+# wgerfrom 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 Workoutdiff --git a/wger/manager/tests/test_workout_canonical.py b/wger/manager/tests/test_workout_canonical.pyindex 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 Libraryfrom decimal import Decimal+# Third Partyfrom django.core.cache import cache+# wgerfrom wger.core.models import (DaysOfWeek,RepetitionUnit,@@ -24,10 +27,10 @@ from wger.core.models import (from wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.exercises.models import Exercisefrom wger.manager.models import (- Workout,Day,Set,- Setting+ Setting,+ Workout)from wger.utils.cache import cache_mapperdiff --git a/wger/manager/tests/test_workout_session.py b/wger/manager/tests/test_workout_session.pyindex 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 Libraryimport datetime+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.cache import cachefrom django.core.exceptions import ValidationError-from django.core.urlresolvers import reverse, reverse_lazy+from django.core.urlresolvers import (+ reverse,+ reverse_lazy+)+# wgerfrom 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_mapperdiff --git a/wger/manager/urls.py b/wger/manager/urls.pyindex 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+# wgerfrom wger.manager.views import (+ day,+ ical,+ log,pdf,schedule,schedule_step,- ical,- workout,- log,set,- day,+ workout,workout_session)+# sub patterns for workout logspatterns_log = [url(r'^(?P<pk>\d+)/view$',diff --git a/wger/manager/views/day.py b/wger/manager/views/day.pyindex 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 Libraryimport logging+# Third Party+from django.contrib.auth.decorators import login_requiredfrom django.contrib.auth.mixins import LoginRequiredMixin-from django.shortcuts import render-from django.shortcuts import get_object_or_404-from django.http import HttpResponseRedirectfrom 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+)++# wgerfrom wger.core.models import DaysOfWeek-from wger.manager.models import Workout, Dayfrom wger.manager.forms import DayForm+from wger.manager.models import (+ Day,+ Workout+)from wger.utils.generic_views import WgerFormMixindiff --git a/wger/manager/views/ical.py b/wger/manager/views/ical.pyindex 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 Libraryimport 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 sixfrom 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+# wgerfrom 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.pyindex 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 datetimeimport loggingimport uuid-import datetime+# Third Partyfrom 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-)+# wgerfrom 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.pyindex 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 Libraryimport 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_404from 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.pyindex 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 Libraryimport 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_requiredfrom django.views.generic import (CreateView,DeleteView,UpdateView)-from reportlab.lib.pagesizes import A4from reportlab.lib.units import cmfrom reportlab.platypus import (- SimpleDocTemplate,Paragraph,+ SimpleDocTemplate,Spacer)-from wger.manager.models import Schedule+# wgerfrom wger.manager.helpers import render_workout_day+from wger.manager.models import Schedulefrom 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_footerlogger = logging.getLogger(__name__)diff --git a/wger/manager/views/schedule_step.py b/wger/manager/views/schedule_step.pyindex 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 Libraryimport logging+# Third Partyfrom django.contrib.auth.mixins import PermissionRequiredMixinfrom 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)+# wgerfrom 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.pyindex 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 Libraryimport 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_requiredfrom django.core.exceptions import ObjectDoesNotExist+from django.core.urlresolvers import reversefrom 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 LanguageConfigfrom wger.exercises.models import Exercisefrom 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.pyindex 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 datetimeimport loggingimport 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 Partyfrom 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+)+# wgerfrom 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_tokendiff --git a/wger/manager/views/workout_session.py b/wger/manager/views/workout_session.pyindex 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 Libraryimport datetime+import logging+# Third Partyfrom 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)+# wgerfrom wger.manager.forms import WorkoutSessionFormfrom 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.pyindex 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 Partyfrom tastypie import fieldsfrom 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, LanguageResourceclass IngredientResource(ModelResource):diff --git a/wger/nutrition/api/serializers.py b/wger/nutrition/api/serializers.pyindex 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 Partyfrom rest_framework import serializers++# wgerfrom 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.pyindex 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 Partyfrom 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+# wgerfrom wger.nutrition.api.serializers import (- NutritionPlanSerializer,+ IngredientSerializer,IngredientWeightUnitSerializer,- WeightUnitSerializer,MealItemSerializer,MealSerializer,- IngredientSerializer+ NutritionPlanSerializer,+ WeightUnitSerializer)from wger.nutrition.forms import UnitChooserFormfrom 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_languagefrom wger.utils.viewsets import WgerOwnerObjectModelViewSetdiff --git a/wger/nutrition/forms.py b/wger/nutrition/forms.pyindex 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 Libraryimport logging+# Third Partyfrom django import formsfrom django.utils.translation import ugettext as _-from wger.core.models import UserProfile+# wger+from wger.core.models import UserProfilefrom wger.nutrition.models import (- IngredientWeightUnit,Ingredient,+ IngredientWeightUnit,MealItem)from wger.utils.widgets import Html5NumberInputdiff --git a/wger/nutrition/models.py b/wger/nutrition/models.pyindex 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 settingsfrom django.contrib.auth.models import Userfrom 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 translationfrom django.utils.encoding import python_2_unicode_compatiblefrom django.utils.translation import ugettext_lazy as _-from django.utils import translation-from django.conf import settings+# wgerfrom wger.core.models import Language-from wger.utils.constants import TWOPLACESfrom wger.utils.cache import cache_mapper+from wger.utils.constants import TWOPLACESfrom wger.utils.fields import Html5TimeField-from wger.utils.models import AbstractLicenseModel, AbstractSubmissionModel+from wger.utils.models import (+ AbstractLicenseModel,+ AbstractSubmissionModel+)from wger.utils.units import AbstractWeightfrom wger.weight.models import WeightEntry+MEALITEM_WEIGHT_GRAM = '1'MEALITEM_WEIGHT_UNIT = '2'diff --git a/wger/nutrition/sitemap.py b/wger/nutrition/sitemap.pyindex 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 Partyfrom django.contrib.sitemaps import Sitemap+# wgerfrom wger.nutrition.models import Ingredientfrom wger.utils.language import load_languagediff --git a/wger/nutrition/tests/test_bmi.py b/wger/nutrition/tests/test_bmi.pyindex 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 Libraryimport datetimeimport jsonfrom decimal import Decimal+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.models import UserProfilefrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.utils.constants import TWOPLACESdiff --git a/wger/nutrition/tests/test_calories_calculator.py b/wger/nutrition/tests/test_calories_calculator.pyindex 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 Libraryimport datetimeimport decimalimport json+# Third Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.utils.constants import TWOPLACESfrom wger.weight.models import WeightEntrydiff --git a/wger/nutrition/tests/test_copy_plan.py b/wger/nutrition/tests/test_copy_plan.pyindex 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 Partyfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.nutrition.models import NutritionPlandiff --git a/wger/nutrition/tests/test_ingredient.py b/wger/nutrition/tests/test_ingredient.pyindex 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 Libraryimport datetimeimport jsonfrom decimal import Decimal+# Third Partyfrom django.core.exceptions import ValidationErrorfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.models import Languagefrom wger.core.tests import api_base_testfrom 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 Mealfrom wger.utils.constants import NUTRITION_TABdiff --git a/wger/nutrition/tests/test_ingredient_overview.py b/wger/nutrition/tests/test_ingredient_overview.pyindex 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 Partyfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.utils.constants import PAGINATION_OBJECTS_PER_PAGEdiff --git a/wger/nutrition/tests/test_meal.py b/wger/nutrition/tests/test_meal.pyindex 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 Libraryimport datetime+# Third Partyfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests import api_base_testfrom 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 NutritionPlanclass MealRepresentationTestCase(WorkoutManagerTestCase):diff --git a/wger/nutrition/tests/test_meal_item.py b/wger/nutrition/tests/test_meal_item.pyindex 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 Partyfrom django.core.urlresolvers import reverse+# wgerfrom 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 MealItemdiff --git a/wger/nutrition/tests/test_nutritional_calculations.py b/wger/nutrition/tests/test_nutritional_calculations.pyindex 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 Libraryimport loggingfrom decimal import Decimal+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.nutrition import modelsfrom wger.utils.constants import TWOPLACES+logger = logging.getLogger(__name__)diff --git a/wger/nutrition/tests/test_pdf.py b/wger/nutrition/tests/test_pdf.pyindex 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 Partyfrom django.contrib.auth.models import Userfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.models import Languagefrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.nutrition.models import NutritionPlandiff --git a/wger/nutrition/tests/test_plan.py b/wger/nutrition/tests/test_plan.pyindex 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 Partyfrom django.core.urlresolvers import reverse+# wgerfrom 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 NutritionPlandiff --git a/wger/nutrition/tests/test_submitted_ingredient.py b/wger/nutrition/tests/test_submitted_ingredient.pyindex 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 Partyfrom django.core import mailfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.nutrition.models import Ingredientdiff --git a/wger/nutrition/tests/test_weight_unit.py b/wger/nutrition/tests/test_weight_unit.pyindex 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 Partyfrom django.core.urlresolvers import reverse+# wgerfrom 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 WeightUnitfrom wger.utils.constants import PAGINATION_OBJECTS_PER_PAGEdiff --git a/wger/nutrition/tests/test_weight_unit_ingredient.py b/wger/nutrition/tests/test_weight_unit_ingredient.pyindex 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+)+# wgerfrom 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.pyindex 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 Partyfrom django.conf.urls import (- url,- include+ include,+ url)+from django.contrib.auth.decorators import login_required+# wgerfrom wger.nutrition.views import (- ingredient,bmi,calculator,- plan,+ ingredient,meal,meal_item,+ plan,unit,unit_ingredient)+# sub patterns for nutritional planspatterns_plan = [url(r'^overview/$',diff --git a/wger/nutrition/views/bmi.py b/wger/nutrition/views/bmi.pyindex 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 Libraryimport json+import logging+# Third Partyfrom django.contrib.auth.decorators import login_requiredfrom django.http import HttpResponsefrom django.shortcuts import render+# wgerfrom wger.nutrition.forms import BmiFormfrom wger.utils import helpers+logger = logging.getLogger(__name__)'''diff --git a/wger/nutrition/views/calculator.py b/wger/nutrition/views/calculator.pyindex 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 Libraryimport json+import logging+# Third Partyfrom django.contrib.auth.decorators import login_requiredfrom django.http import HttpResponsefrom django.shortcuts import render+# wgerfrom wger.nutrition.forms import (BmrForm,- PhysicalActivitiesForm,- DailyCaloriesForm+ DailyCaloriesForm,+ PhysicalActivitiesForm)diff --git a/wger/nutrition/views/ingredient.py b/wger/nutrition/views/ingredient.pyindex 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 Libraryimport 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 Partyfrom 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)+# wgerfrom wger.nutrition.forms import UnitChooserFormfrom wger.nutrition.models import Ingredient+from wger.utils.cache import cache_mapper+from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGEfrom 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_mapperlogger = logging.getLogger(__name__)diff --git a/wger/nutrition/views/meal.py b/wger/nutrition/views/meal.pyindex 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 Libraryimport logging-from django.shortcuts import get_object_or_404-from django.http import HttpResponseRedirect, HttpResponseForbidden-from django.core.urlresolvers import reverse+# Third Partyfrom 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_404from 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.pyindex 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 Libraryimport logging-from django.shortcuts import get_object_or_404-from django.http import HttpResponseRedirect, HttpResponseForbidden-from django.core.urlresolvers import reverse+# Third Partyfrom 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_404from django.utils.translation import ugettext_lazy-from django.views.generic import CreateView, UpdateView+from django.views.generic import (+ CreateView,+ UpdateView+)+# wgerfrom 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 WgerFormMixindiff --git a/wger/nutrition/views/plan.py b/wger/nutrition/views/plan.pyindex 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 Libraryimport 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_versionfrom 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 styleSheetfrom wger.utils.language import load_language+from wger.utils.pdf import styleSheetlogger = logging.getLogger(__name__)diff --git a/wger/nutrition/views/unit.py b/wger/nutrition/views/unit.pyindex 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)+# wgerfrom wger.nutrition.models import WeightUnitfrom wger.utils.constants import PAGINATION_OBJECTS_PER_PAGE-from wger.utils.language import load_languagefrom 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.pyindex 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 Libraryimport 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_404from django.utils.translation import ugettext_lazy--from wger.utils.language import load_languagefrom django.views.generic import (- DeleteView,CreateView,+ DeleteView,UpdateView)++# wgerfrom wger.nutrition.models import (Ingredient,IngredientWeightUnit,WeightUnit)from wger.utils.generic_views import (- WgerFormMixin,- WgerDeleteMixin+ WgerDeleteMixin,+ WgerFormMixin)+from wger.utils.language import load_languagelogger = logging.getLogger(__name__)diff --git a/wger/settings_global.py b/wger/settings_global.pyindex 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 osimport reimport 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 osBASE_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.pyindex 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 Partyfrom django.conf.urls import url-from django.views.generic import TemplateView, RedirectView+from django.views.generic import (+ RedirectView,+ TemplateView+)+# wgerfrom wger.software import views+urlpatterns = [url(r'^issues$',diff --git a/wger/software/views.py b/wger/software/views.pyindex 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 Libraryimport logging+# Third Partyfrom django.conf import settings-from django.shortcuts import render+logger = logging.getLogger(__name__)diff --git a/wger/tasks.py b/wger/tasks.pyindex 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 E402import 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.pyindex 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 Partyfrom 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_patternsfrom django.conf.urls.static import static+from django.contrib import adminfrom 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 adminadmin.autodiscover()diff --git a/wger/utils/cache.py b/wger/utils/cache.pyindex 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 Libraryimport hashlib+import logging+# Third Partyfrom django.core.cache import cachefrom django.utils.encoding import force_bytesdiff --git a/wger/utils/constants.py b/wger/utils/constants.pyindex 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 Libraryfrom decimal import Decimaldiff --git a/wger/utils/context_processor.py b/wger/utils/context_processor.pyindex 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 Partyfrom django.conf import settingsfrom django.templatetags.static import static+# wgerfrom wger import get_versionfrom wger.config.models import GymConfigfrom wger.utils import constantsdiff --git a/wger/utils/fields.py b/wger/utils/fields.pyindex 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 Libraryimport logging+# Third Partyfrom 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.pyindex 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 Libraryimport logging-import bleach-from django.utils.translation import ugettext_lazy+# Third Party+import bleachfrom django.contrib import messagesfrom 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_lazyfrom django.views.generic import TemplateView-from django.http import HttpResponseRedirect, HttpResponseForbidden+from django.views.generic.edit import ModelFormMixin+# wgerfrom 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.pyindex 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 loggingimport osimport randomimport string-import logging-import decimal-import json-import datetime-from functools import wraps-from django.http import Http404+# Third Partyfrom django.contrib.auth.models import Userfrom django.contrib.auth.tokens import default_token_generator+from django.http import Http404from django.shortcuts import get_object_or_404from 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.pyindex 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 Libraryimport logging-from django.utils import translation-from django.core.exceptions import ObjectDoesNotExist+# Third Partyfrom django.core.cache import cache-from wger.core.models import Language+from django.core.exceptions import ObjectDoesNotExist+from django.utils import translation+# wgerfrom wger.config.models import LanguageConfig+from wger.core.models import Languagefrom wger.utils.cache import cache_mapperdiff --git a/wger/utils/managers.py b/wger/utils/managers.pyindex 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 Partyfrom django.db import modelsfrom django.db.models.query import QuerySet++# wgerfrom wger.utils.models import AbstractSubmissionModeldiff --git a/wger/utils/middleware.py b/wger/utils/middleware.pyindex 9083f6ea5..a2ec858ff 100644--- a/wger/utils/middleware.py+++ b/wger/utils/middleware.py@@ -16,13 +16,16 @@Custom middleware'''+# Standard Libraryimport logging+# Third Partyfrom django.conf import settingsfrom django.contrib import auth-from django.utils.functional import SimpleLazyObjectfrom django.contrib.auth import login as django_login+from django.utils.functional import SimpleLazyObject+# wgerfrom wger.core.demo import create_temporary_userdiff --git a/wger/utils/models.py b/wger/utils/models.pyindex 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 Partyfrom django.db import modelsfrom django.utils.translation import ugettext_lazy as _+# wgerfrom wger.core.models import Licensediff --git a/wger/utils/pdf.py b/wger/utils/pdf.pyindex 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 Libraryimport datetimefrom os.path import join as path_join+# Third Partyfrom django.conf import settings-from django.utils import translationfrom 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 TTFontfrom reportlab.platypus import Paragraph+# wgerfrom wger import get_versionfrom wger.core.models import Languagediff --git a/wger/utils/permissions.py b/wger/utils/permissions.pyindex 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 Partyfrom rest_framework import permissionsdiff --git a/wger/utils/resources.py b/wger/utils/resources.pyindex 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 Libraryimport logging+# Third Partyfrom tastypie.authorization import ReadOnlyAuthorization+logger = logging.getLogger(__name__)diff --git a/wger/utils/tests/test_capitalizer.py b/wger/utils/tests/test_capitalizer.pyindex 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+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.utils.helpers import smart_capitalizediff --git a/wger/utils/tests/test_check_access.py b/wger/utils/tests/test_check_access.pyindex 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+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.utils.helpers import check_accessdiff --git a/wger/utils/tests/test_middleware.py b/wger/utils/tests/test_middleware.pyindex 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 Partyfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasediff --git a/wger/utils/tests/test_unit_conversion.py b/wger/utils/tests/test_unit_conversion.pyindex 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 Libraryfrom decimal import Decimal+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.utils.constants import FOURPLACESfrom wger.utils.units import AbstractWeightdiff --git a/wger/utils/tests/test_user_agents.py b/wger/utils/tests/test_user_agents.pyindex 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+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCase-from wger.utils import user_agentsdiff --git a/wger/utils/units.py b/wger/utils/units.pyindex 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 Libraryimport loggingfrom decimal import Decimal+# wgerfrom wger.utils.constants import FOURPLACESdiff --git a/wger/utils/user_agents.py b/wger/utils/user_agents.pyindex 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 Libraryimport logging+logger = logging.getLogger(__name__)diff --git a/wger/utils/viewsets.py b/wger/utils/viewsets.pyindex 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.pyindex 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 Licenseimport uuid-import loggingfrom itertools import chain+# Third Party+from django.forms import fieldsfrom 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.pyindex 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 Partyfrom 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.pyindex 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 Partyfrom tastypie.authentication import ApiKeyAuthentication-from tastypie.resources import ModelResourcefrom tastypie.constants import ALL+from tastypie.resources import ModelResource-from wger.weight.models import WeightEntry+# wgerfrom wger.utils.resources import UserObjectsOnlyAuthorization+from wger.weight.models import WeightEntryclass WeightEntryResource(ModelResource):diff --git a/wger/weight/api/serializers.py b/wger/weight/api/serializers.pyindex 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 Partyfrom rest_framework import serializers+# wgerfrom wger.weight.models import WeightEntrydiff --git a/wger/weight/api/views.py b/wger/weight/api/views.pyindex 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 Partyfrom rest_framework import viewsets-from wger.weight.api.serializers import WeightEntrySerializer+# wger+from wger.weight.api.serializers import WeightEntrySerializerfrom wger.weight.models import WeightEntrydiff --git a/wger/weight/forms.py b/wger/weight/forms.pyindex 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 Partyfrom 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 _+# wgerfrom wger.utils.constants import DATE_FORMATSfrom wger.utils.widgets import Html5DateInputfrom wger.weight.models import WeightEntrydiff --git a/wger/weight/helpers.py b/wger/weight/helpers.pyindex 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 csvimport datetimeimport decimal-import csvimport json+import loggingfrom collections import OrderedDict+# Third Party+import sixfrom 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 DecimalJsonEncoderfrom 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.pyindex 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 Libraryimport 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 Sitefrom django.core import mail-from django.utils.translation import ugettext_lazy as _+from django.core.management.base import BaseCommand+from django.template import loaderfrom django.utils import translation-from django.conf import settings+from django.utils.translation import ugettext_lazy as _-from django.contrib.sites.models import Site+# wgerfrom wger.core.models import UserProfilefrom wger.weight.models import WeightEntrydiff --git a/wger/weight/models.py b/wger/weight/models.pyindex 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 Partyfrom django.contrib.auth.models import User+from django.core.validators import (+ MaxValueValidator,+ MinValueValidator+)+from django.db import modelsfrom django.utils.encoding import python_2_unicode_compatiblefrom django.utils.translation import ugettext_lazy as _diff --git a/wger/weight/tests/test_csv_export.py b/wger/weight/tests/test_csv_export.pyindex 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 Libraryimport logging+# Third Partyfrom django.core.urlresolvers import reverse+# wgerfrom 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.pyindex 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 Libraryimport logging+# Third Partyfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom 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.pyindex 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 Partyfrom django.contrib.auth.models import Userfrom django.core import mailfrom django.core.management import call_command+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCasefrom wger.weight.models import WeightEntrydiff --git a/wger/weight/tests/test_entry.py b/wger/weight/tests/test_entry.pyindex 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 Libraryimport datetimeimport decimal+# Third Partyfrom django.core.urlresolvers import reverse+# wgerfrom 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 TWOPLACESfrom wger.weight.models import WeightEntrydiff --git a/wger/weight/tests/test_overview.py b/wger/weight/tests/test_overview.pyindex 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 Libraryimport logging+# Third Partyfrom django.core.urlresolvers import reverse+# wgerfrom wger.core.tests.base_testcase import WorkoutManagerTestCase+logger = logging.getLogger(__name__)diff --git a/wger/weight/urls.py b/wger/weight/urls.pyindex 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 Partyfrom django.conf.urls import urlfrom django.contrib.auth.decorators import login_required-from wger.weight.forms import WeightCsvImportForm+# wgerfrom wger.weight import views+from wger.weight.forms import WeightCsvImportFormurlpatterns = [diff --git a/wger/weight/views.py b/wger/weight/views.pyindex 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 Libraryimport csvimport 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 Partyfrom 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 helpersfrom wger.weight.forms import WeightFormfrom wger.weight.models import WeightEntry-from wger.weight import helpers-from wger.utils.helpers import check_access-from wger.utils.generic_views import WgerFormMixinlogger = logging.getLogger(__name__)diff --git a/wger/wsgi.py b/wger/wsgi.pyindex 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 anotherframework."""+# Standard Libraryimport os++# Third Partyfrom 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