From 1000d773f04bb8eceed9629ef400e0be967ff4c1 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 19 Feb 2018 21:09:07 +0100 Subject: [PATCH] refactor according to PEP8 --- django/didgeridoo/webshop/utils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/django/didgeridoo/webshop/utils.py b/django/didgeridoo/webshop/utils.py index aed4192..08521d7 100644 --- a/django/didgeridoo/webshop/utils.py +++ b/django/didgeridoo/webshop/utils.py @@ -1,16 +1,16 @@ -from webshop.models import (Article, - Category, +from webshop.models import (Category, ArticleStatus) from currencies.models import ExchangeRate, ExchangeRate_name from currencies.forms import CurrenciesForm + def process_article_prices(request, articles): articles_list = list(articles) rate = ExchangeRate currency_name = "CHF" - if not 'currency' in request.session: + if 'currency' not in request.session: request.session['currency'] = None if request.method == 'POST': @@ -27,13 +27,14 @@ def process_article_prices(request, articles): if request.session['currency']: currency = request.session['currency'] for idx, article in enumerate(articles_list): - article.price_in_chf = rate.exchange(currency, article.price_in_chf) + article.price_in_chf = rate.exchange(currency, + article.price_in_chf) articles_list[idx] = article currency_name = ExchangeRate_name.objects.get(id=currency) - return {'request':request, - 'currency_name':currency_name, - 'articles_list':articles_list} + return {'request': request, + 'currency_name': currency_name, + 'articles_list': articles_list} def get_categories():