Fix news patch

This commit is contained in:
Kuroshini 2019-12-26 18:34:59 +03:00
parent 396921fa75
commit 0da58133fc

View File

@ -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):