mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
url import fixes
This commit is contained in:
@@ -373,8 +373,8 @@ def parse_servings(servings):
|
||||
servings = 1
|
||||
elif isinstance(servings, list):
|
||||
try:
|
||||
servings = int(re.findall(r'\b\d+\b', servings[0])[0])
|
||||
except KeyError:
|
||||
servings = int(re.findall(r'\b\d+\b', str(servings[0]))[0])
|
||||
except (KeyError, IndexError):
|
||||
servings = 1
|
||||
return servings
|
||||
|
||||
|
||||
@@ -861,7 +861,7 @@ class IngredientViewSet(viewsets.ModelViewSet):
|
||||
if unit and re.match(r'^(\d)+$', unit):
|
||||
queryset = queryset.filter(unit_id=unit)
|
||||
|
||||
return queryset
|
||||
return queryset.select_related('food')
|
||||
|
||||
|
||||
class StepViewSet(viewsets.ModelViewSet):
|
||||
|
||||
Reference in New Issue
Block a user