From 0da58133fc4faa4504a2c851492f4810b4a9ce57 Mon Sep 17 00:00:00 2001 From: Kuroshini Date: Thu, 26 Dec 2019 18:34:59 +0300 Subject: [PATCH] Fix news patch --- apps/news/serializers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/news/serializers.py b/apps/news/serializers.py index e3ffd01f..9bff32af 100644 --- a/apps/news/serializers.py +++ b/apps/news/serializers.py @@ -214,12 +214,12 @@ class NewsBackOfficeBaseSerializer(NewsBaseSerializer): 'active': True, 'inactive': False, } - attrs['slugs'] = {obj['locale']: obj['slug'] for obj in descriptions} - attrs['title'] = {obj['locale']: obj['title'] for obj in descriptions} + attrs['slugs'] = {obj['locale']: obj['slug'] for obj in descriptions if 'slug' in obj} + attrs['title'] = {obj['locale']: obj['title'] for obj in descriptions if 'title' in obj} attrs['locale_to_description_is_active'] = { obj['locale']: status_to_bool[obj['status']] for obj in descriptions } - attrs['description'] = {obj['locale']: obj['text'] for obj in descriptions} + attrs['description'] = {obj['locale']: obj['text'] for obj in descriptions if 'text' in obj} return attrs def create(self, validated_data):