merge clashing commits

This commit is contained in:
smilerz
2022-02-07 18:11:38 -06:00
parent 286c6344ec
commit 93b7e5790d
3 changed files with 16 additions and 33 deletions

View File

@@ -1,9 +1,10 @@
# Generated by Django 3.2.11 on 2022-02-07 17:48 # Generated by Django 3.2.11 on 2022-02-07 17:48
import cookbook.models import django.db.models.deletion
from django.conf import settings from django.conf import settings
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
import cookbook.models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@@ -1,18 +0,0 @@
# Generated by Django 3.2.11 on 2022-02-04 17:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0171_auto_20220202_1340'),
]
operations = [
migrations.AddField(
model_name='food',
name='child_inherit_fields',
field=models.ManyToManyField(blank=True, related_name='child_inherit', to='cookbook.FoodInheritField'),
),
]

View File

@@ -1,5 +1,5 @@
from datetime import timedelta from datetime import timedelta
from decimal import Decimal
from gettext import gettext as _ from gettext import gettext as _
from django.contrib.auth.models import User from django.contrib.auth.models import User
@@ -12,13 +12,13 @@ from rest_framework.exceptions import NotFound, ValidationError
from cookbook.helper.HelperFunctions import str2bool from cookbook.helper.HelperFunctions import str2bool
from cookbook.helper.shopping_helper import RecipeShoppingEditor from cookbook.helper.shopping_helper import RecipeShoppingEditor
from cookbook.models import (Automation, BookmarkletImport, Comment, CookLog, CustomFilter, Food, from cookbook.models import (Automation, BookmarkletImport, Comment, CookLog, CustomFilter,
FoodInheritField, ImportLog, Ingredient, Keyword, MealPlan, MealType, ExportLog, Food, FoodInheritField, ImportLog, Ingredient, Keyword,
NutritionInformation, Recipe, RecipeBook, RecipeBookEntry, MealPlan, MealType, NutritionInformation, Recipe, RecipeBook,
RecipeImport, ShareLink, ShoppingList, ShoppingListEntry, RecipeBookEntry, RecipeImport, ShareLink, ShoppingList,
ShoppingListRecipe, Step, Storage, Supermarket, SupermarketCategory, ShoppingListEntry, ShoppingListRecipe, Step, Storage, Supermarket,
SupermarketCategoryRelation, Sync, SyncLog, Unit, UserFile, SupermarketCategory, SupermarketCategoryRelation, Sync, SyncLog, Unit,
UserPreference, ViewLog, ExportLog) UserFile, UserPreference, ViewLog)
from cookbook.templatetags.custom_tags import markdown from cookbook.templatetags.custom_tags import markdown
from recipes.settings import MEDIA_URL from recipes.settings import MEDIA_URL
@@ -731,11 +731,11 @@ class ShoppingListRecipeSerializer(serializers.ModelSerializer):
value = Decimal(value) value = Decimal(value)
value = value.quantize(Decimal(1)) if value == value.to_integral() else value.normalize() # strips trailing zero value = value.quantize(Decimal(1)) if value == value.to_integral() else value.normalize() # strips trailing zero
return ( return (
obj.name obj.name
or getattr(obj.mealplan, 'title', None) or getattr(obj.mealplan, 'title', None)
or (d := getattr(obj.mealplan, 'date', None)) and ': '.join([obj.mealplan.recipe.name, str(d)]) or (d := getattr(obj.mealplan, 'date', None)) and ': '.join([obj.mealplan.recipe.name, str(d)])
or obj.recipe.name or obj.recipe.name
) + f' ({value:.2g})' ) + f' ({value:.2g})'
def update(self, instance, validated_data): def update(self, instance, validated_data):
# TODO remove once old shopping list # TODO remove once old shopping list