merge work in subtitle
This commit is contained in:
parent
03ee9c1279
commit
523e3a1ca0
|
|
@ -28,7 +28,7 @@ class NewsSerializer(serializers.Serializer):
|
|||
'old_id': validated_data['old_id'],
|
||||
'news_type': validated_data['news_type'],
|
||||
'title': {validated_data['locale']: validated_data['news_title']},
|
||||
'subtitle': {validated_data['locale']: validated_data['title']},
|
||||
'subtitle': self.get_subtitle(validated_data),
|
||||
'description': self.get_description(validated_data),
|
||||
'start': validated_data['created_at'],
|
||||
'slug': generate_unique_slug(News, validated_data['slug']),
|
||||
|
|
@ -91,16 +91,10 @@ class NewsSerializer(serializers.Serializer):
|
|||
def get_title(data):
|
||||
return {data['locale']: data['title']}
|
||||
|
||||
@staticmethod
|
||||
def get_description(data):
|
||||
content = None
|
||||
if data['body']:
|
||||
content = parse_legacy_news_content(data['body'])
|
||||
return {data['locale']: content}
|
||||
|
||||
@staticmethod
|
||||
def get_subtitle(data):
|
||||
if 'summary' in data:
|
||||
content = data.pop('summary')
|
||||
if content:
|
||||
return {data['locale']: content}
|
||||
if not content:
|
||||
content = {data['locale']: data['title']}
|
||||
return {data['locale']: content}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user