Skip to content

Commit

Permalink
Merge 2eee3b5 into 3399bb4
Browse files Browse the repository at this point in the history
  • Loading branch information
RrNn committed Aug 24, 2018
2 parents 3399bb4 + 2eee3b5 commit bcd3667
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion wger/exercises/views/exercises.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
TranslatedOriginalSelectMultiple
)
from wger.config.models import LanguageConfig
from wger.config.models import Language
from wger.weight.helpers import process_log_entries


Expand All @@ -77,7 +78,10 @@ def get_queryset(self):
'''
Filter to only active exercises in the configured languages
'''
languages = load_item_languages(LanguageConfig.SHOW_ITEM_EXERCISES)
url = self.request.META['PATH_INFO']
lang_name = url[1:3]
languages = Language.objects.filter(short_name=lang_name)

return Exercise.objects.accepted() \
.filter(language__in=languages) \
.order_by('category__id') \
Expand Down
6 changes: 4 additions & 2 deletions wger/nutrition/views/ingredient.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from wger.utils.constants import PAGINATION_OBJECTS_PER_PAGE
from wger.utils.language import load_language, load_ingredient_languages
from wger.utils.cache import cache_mapper

from wger.config.models import Language

logger = logging.getLogger(__name__)

Expand All @@ -64,7 +64,9 @@ def get_queryset(self):
(the user can also want to see ingredients in English, in addition to his
native language, see load_ingredient_languages)
'''
languages = load_ingredient_languages(self.request)
url = self.request.META['PATH_INFO']
lang_name = url[1:3]
languages = Language.objects.filter(short_name=lang_name)
return (Ingredient.objects.filter(language__in=languages)
.filter(status__in=Ingredient.INGREDIENT_STATUS_OK)
.only('id', 'name'))
Expand Down

0 comments on commit bcd3667

Please sign in to comment.