Skip to content

Commit

Permalink
Merge pull request #526 from sneeu/master
Browse files Browse the repository at this point in the history
Replace `smart_text` with `smart_str`
  • Loading branch information
benjaoming committed Nov 7, 2019
2 parents a4a47f6 + 35da52b commit bf122af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions djmoney/models/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.db.models import F, Field, Func, Value
from django.db.models.expressions import BaseExpression
from django.db.models.signals import class_prepared
from django.utils.encoding import smart_text
from django.utils.encoding import smart_str
from django.utils.functional import cached_property

from djmoney import forms
Expand Down Expand Up @@ -76,7 +76,7 @@ def get_currency(value):
Extracts currency from value.
"""
if isinstance(value, MONEY_CLASSES):
return smart_text(value.currency)
return smart_str(value.currency)
elif isinstance(value, (list, tuple)):
return value[1]

Expand Down
6 changes: 3 additions & 3 deletions djmoney/models/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.db.models.constants import LOOKUP_SEP
from django.db.models.expressions import BaseExpression
from django.db.models.fields import FieldDoesNotExist
from django.utils.encoding import smart_text
from django.utils.encoding import smart_str

from ..utils import MONEY_CLASSES, get_currency_field_name, prepare_expression
from .fields import CurrencyField, MoneyField
Expand Down Expand Up @@ -98,7 +98,7 @@ def _expand_arg(model, arg):
if isinstance(value, MONEY_CLASSES):
clean_name = _get_clean_name(model, name)
currency_field_name = get_currency_field_name(clean_name, field)
arg.children[i] = Q(child, (currency_field_name, smart_text(value.currency)))
arg.children[i] = Q(child, (currency_field_name, smart_str(value.currency)))
if isinstance(field, MoneyField):
if isinstance(value, (BaseExpression, F)):
clean_name = _get_clean_name(model, name)
Expand Down Expand Up @@ -138,7 +138,7 @@ def _expand_money_kwargs(model, args=(), kwargs=None, exclusions=()):
clean_name = _get_clean_name(model, name)
kwargs[name] = value.amount
currency_field_name = get_currency_field_name(clean_name, field)
kwargs[currency_field_name] = smart_text(value.currency)
kwargs[currency_field_name] = smart_str(value.currency)
else:
if isinstance(field, MoneyField):
if isinstance(value, (BaseExpression, F)) and not isinstance(value, Case):
Expand Down

0 comments on commit bf122af

Please sign in to comment.