mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
various fixes
This commit is contained in:
@@ -1041,7 +1041,7 @@ class RecipeImageSerializer(WritableNestedModelSerializer):
|
||||
def create(self, validated_data):
|
||||
if 'image' in validated_data and not is_file_type_allowed(validated_data['image'].name, image_only=True):
|
||||
return None
|
||||
return super().create( validated_data)
|
||||
return super().create(validated_data)
|
||||
|
||||
def update(self, instance, validated_data):
|
||||
if 'image' in validated_data and not is_file_type_allowed(validated_data['image'].name, image_only=True):
|
||||
@@ -1151,6 +1151,13 @@ class MealPlanSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
|
||||
SLR.create(mealplan=mealplan, servings=validated_data['servings'])
|
||||
return mealplan
|
||||
|
||||
def update(self, obj, validated_data):
|
||||
if sr := ShoppingListRecipe.objects.filter(mealplan=obj.id).first():
|
||||
SLR = RecipeShoppingEditor(user=obj.created_by, space=obj.space, id=sr.id)
|
||||
SLR.edit(mealplan=obj, servings=validated_data['servings'])
|
||||
|
||||
return super().update(obj, validated_data)
|
||||
|
||||
class Meta:
|
||||
model = MealPlan
|
||||
fields = (
|
||||
@@ -1311,7 +1318,8 @@ class ViewLogSerializer(serializers.ModelSerializer):
|
||||
validated_data['created_by'] = self.context['request'].user
|
||||
validated_data['space'] = self.context['request'].space
|
||||
|
||||
view_log = ViewLog.objects.filter(recipe=validated_data['recipe'], created_by=self.context['request'].user, created_at__gt=(timezone.now() - timezone.timedelta(minutes=5)), space=self.context['request'].space).first()
|
||||
view_log = ViewLog.objects.filter(recipe=validated_data['recipe'], created_by=self.context['request'].user, created_at__gt=(timezone.now() - timezone.timedelta(minutes=5)),
|
||||
space=self.context['request'].space).first()
|
||||
if not view_log:
|
||||
view_log = ViewLog.objects.create(recipe=validated_data['recipe'], created_by=self.context['request'].user, space=self.context['request'].space)
|
||||
|
||||
|
||||
@@ -533,14 +533,14 @@ def web_manifest(request):
|
||||
"url": "./mealplan",
|
||||
"icons": [
|
||||
{
|
||||
"src": static('logo_color_plan.svg'),
|
||||
"src": static('assets/logo_color_plan.svg'),
|
||||
"sizes": "any"
|
||||
}, {
|
||||
"src": static('logo_color_plan_144.png'),
|
||||
"src": static('assets/logo_color_plan_144.png'),
|
||||
"type": "image/png",
|
||||
"sizes": "144x144"
|
||||
}, {
|
||||
"src": static('logo_color_plan_512.png'),
|
||||
"src": static('assets/logo_color_plan_512.png'),
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
@@ -552,14 +552,14 @@ def web_manifest(request):
|
||||
"url": "./shopping",
|
||||
"icons": [
|
||||
{
|
||||
"src": static('logo_color_shopping.svg'),
|
||||
"src": static('assets/logo_color_shopping.svg'),
|
||||
"sizes": "any"
|
||||
}, {
|
||||
"src": static('logo_color_shopping_144.png'),
|
||||
"src": static('assets/logo_color_shopping_144.png'),
|
||||
"type": "image/png",
|
||||
"sizes": "144x144"
|
||||
}, {
|
||||
"src": static('logo_color_shopping_512.png'),
|
||||
"src": static('assets/logo_color_shopping_512.png'),
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
@@ -568,6 +568,7 @@ def web_manifest(request):
|
||||
"share_target": {
|
||||
"action": "/recipe/import",
|
||||
"method": "GET",
|
||||
"enctype": "application/x-www-form-urlencoded",
|
||||
"params": {
|
||||
"title": "title",
|
||||
"url": "url",
|
||||
|
||||
Reference in New Issue
Block a user