From 12ff1915c5f82efbe170ceb75595d2acec83c2c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Bodor?= <35693959+bmate711@users.noreply.github.com> Date: Sat, 2 Feb 2019 16:39:35 +0100 Subject: [PATCH] Note (#40) * emails * update dependenis and fix flake8 error * update dependenis and fix flake8 error --- requirements/production.txt | 8 ++++---- src/common/email.py | 4 ++-- src/homework/serializers.py | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/requirements/production.txt b/requirements/production.txt index 273e15c..d440300 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -11,7 +11,7 @@ diff-match-patch==20121119 # via django-import-export django-import-export==1.0.0 django-social-authsch==0.1 django-solo==1.1.3 -django==2.0.1 +django>=2.0.10 djangorestframework==3.7.7 et-xmlfile==1.0.1 # via openpyxl gunicorn==19.7.1 @@ -23,14 +23,14 @@ openpyxl==2.5.0 # via tablib pyjwt==1.5.3 # via social-auth-core python3-openid==3.1.0 # via social-auth-core pytz==2017.3 # via django -pyyaml==3.12 # via tablib +pyyaml>=4.2b1 # via tablib requests-oauthlib==0.8.0 # via social-auth-core -requests==2.18.4 # via requests-oauthlib, social-auth-core +requests>=2.20.0 # via requests-oauthlib, social-auth-core six==1.11.0 # via social-auth-app-django, social-auth-core social-auth-app-django==2.1.0 # via django-social-authsch social-auth-core==1.6.0 # via django-social-authsch, social-auth-app-django tablib==0.12.1 # via django-import-export unicodecsv==0.14.1 # via tablib -urllib3==1.22 # via requests +urllib3>=1.23 # via requests xlrd==1.1.0 # via tablib xlwt==1.3.0 # via tablib diff --git a/src/common/email.py b/src/common/email.py index 96b34ca..0c8d6b3 100644 --- a/src/common/email.py +++ b/src/common/email.py @@ -14,7 +14,7 @@ def read_email(name): def registration(user): subject = "KszkĂŠpzĂŠs regisztrĂĄciĂł" message = read_email('registration.txt') - message = str.format(message %{'name': user.get_full_name()}) + message = str.format(message % {'name': user.get_full_name()}) send_mail(subject, message, sender_email, [user.email, ]) @@ -47,5 +47,5 @@ def homework_corrected(user, title, accepted): else: status = 'HibĂĄs' message = read_email('homework_corrected.txt') - message = str.format(message % {'name': user.get_full_name(), 'link': link, 'status': status, 'title': title }) + message = str.format(message % {'name': user.get_full_name(), 'link': link, 'status': status, 'title': title}) send_mail(subject, message, sender_email, [user.email, ]) diff --git a/src/homework/serializers.py b/src/homework/serializers.py index c6e4fde..3ee662e 100755 --- a/src/homework/serializers.py +++ b/src/homework/serializers.py @@ -64,7 +64,7 @@ class SolutionSerializer(serializers.ModelSerializer): return value def update(self, instance, validated_data): - if instance.corrected == False and validated_data.get('corrected', instance.corrected) == True: + if instance.corrected is not True and validated_data.get('corrected', instance.corrected) is True: email.homework_corrected( instance.created_by.user, instance.task.title, @@ -76,4 +76,3 @@ class SolutionSerializer(serializers.ModelSerializer): profile = CurrentUserMiddleware.get_current_user_profile() models.Solution.objects.filter(created_by=profile, task=validated_data['task']).delete() return super().create(validated_data) - -- GitLab