refactor according to PEP8
This commit is contained in:
parent
50c0bd847b
commit
1000d773f0
|
@ -1,16 +1,16 @@
|
||||||
from webshop.models import (Article,
|
from webshop.models import (Category,
|
||||||
Category,
|
|
||||||
ArticleStatus)
|
ArticleStatus)
|
||||||
|
|
||||||
from currencies.models import ExchangeRate, ExchangeRate_name
|
from currencies.models import ExchangeRate, ExchangeRate_name
|
||||||
from currencies.forms import CurrenciesForm
|
from currencies.forms import CurrenciesForm
|
||||||
|
|
||||||
|
|
||||||
def process_article_prices(request, articles):
|
def process_article_prices(request, articles):
|
||||||
articles_list = list(articles)
|
articles_list = list(articles)
|
||||||
rate = ExchangeRate
|
rate = ExchangeRate
|
||||||
currency_name = "CHF"
|
currency_name = "CHF"
|
||||||
|
|
||||||
if not 'currency' in request.session:
|
if 'currency' not in request.session:
|
||||||
request.session['currency'] = None
|
request.session['currency'] = None
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
@ -27,13 +27,14 @@ def process_article_prices(request, articles):
|
||||||
if request.session['currency']:
|
if request.session['currency']:
|
||||||
currency = request.session['currency']
|
currency = request.session['currency']
|
||||||
for idx, article in enumerate(articles_list):
|
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
|
articles_list[idx] = article
|
||||||
currency_name = ExchangeRate_name.objects.get(id=currency)
|
currency_name = ExchangeRate_name.objects.get(id=currency)
|
||||||
|
|
||||||
return {'request':request,
|
return {'request': request,
|
||||||
'currency_name':currency_name,
|
'currency_name': currency_name,
|
||||||
'articles_list':articles_list}
|
'articles_list': articles_list}
|
||||||
|
|
||||||
|
|
||||||
def get_categories():
|
def get_categories():
|
||||||
|
|
Loading…
Reference in New Issue