From 3054297357316cf51a2b20e0930e8683fcfc7276 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 18:11:09 +0100 Subject: [PATCH] improved error handling and fixed meal plan api --- cookbook/serializer.py | 6 ------ cookbook/views/api.py | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/cookbook/serializer.py b/cookbook/serializer.py index 6e8296cbd7..6a841a310c 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -993,12 +993,6 @@ def get_note_markdown(self, obj): def in_shopping(self, obj): return ShoppingListRecipe.objects.filter(mealplan=obj.id).exists() - def update(self, instance, validated_data): - if 'to_date' not in validated_data or validated_data['to_date'] is None: - validated_data['to_date'] = validated_data['from_date'] - - return super().update(instance, validated_data) - def create(self, validated_data): validated_data['created_by'] = self.context['request'].user diff --git a/cookbook/views/api.py b/cookbook/views/api.py index bac4c42a34..d97d5f739c 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -642,7 +642,7 @@ def fdc(self, request, pk): return self.retrieve(request, pk) except Exception as e: traceback.print_exc() - return JsonResponse({'error': f'{e} - check server log'}, status=500, json_dumps_params={'indent': 4}) + return JsonResponse({'msg': f'there was an error parsing the FDC data, please check the server logs'}, status=500, json_dumps_params={'indent': 4}) def destroy(self, *args, **kwargs): try: