Skip to content

Commit

Permalink
improved error handling and fixed meal plan api
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Dec 2, 2023
1 parent 3e083e2 commit 3054297
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 0 additions & 6 deletions cookbook/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cookbook/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3054297

Please sign in to comment.