Skip to content

Commit

Permalink
Move setting getter to allow overrides in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chschuermann committed Jul 3, 2023
1 parent 2e88041 commit e65450c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions translator/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from translator.context_processors import DJANGO_TRANSLATOR_MODELS

CACHE_TIMEOUT = getattr(settings, "DJANGO_TRANSLATOR_CACHE_TIMEOUT", DEFAULT_TIMEOUT)
TRANSLATOR_IS_ENABLED = getattr(settings, "DJANGO_TRANSLATOR_ENABLED", True)


def get_translation_for_key(item, model_class=None):
Expand All @@ -22,7 +21,7 @@ def get_translation_for_key(item, model_class=None):

from translator.models import Translation

if TRANSLATOR_IS_ENABLED:
if getattr(settings, "DJANGO_TRANSLATOR_ENABLED", True):
if not model_class:
model_class = Translation # We are using the Translation model as default

Expand Down

0 comments on commit e65450c

Please sign in to comment.