Skip to content

Commit

Permalink
Merge pull request #1132 from uktrade/develop
Browse files Browse the repository at this point in the history
Release to UAT/Prod
  • Loading branch information
timothyPatterson authored Oct 3, 2023
2 parents 4edca83 + 81863f9 commit 9198c06
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
22 changes: 13 additions & 9 deletions activitystream/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@


class WagtailPageSerializer(serializers.Serializer):
prefix = 'dit:cmsContent'
subtype = 'international'
operation = 'Update'

def get_cms_content_for_obj(self, obj):
try:
result = dict(
id='dit:cmsContent:international:' + str(obj.id),
type='dit:cmsContent',
id=f'{self.prefix}:{self.subtype}:{obj.id}',
type=self.prefix,
title=obj.title,
url=settings.APP_URL_GREAT_INTERNATIONAL+'content'+obj.url,
seo_title=obj.seo_title,
search_description=obj.search_description,
first_published_at=obj.first_published_at.isoformat(),
last_published_at=obj.last_published_at.isoformat(),
content_type_id=obj.content_type_id,
seoTitle=obj.seo_title,
searchDescription=obj.search_description,
firstPublishedAt=obj.first_published_at.isoformat(),
lastPublishedAt=obj.last_published_at.isoformat(),
contentTypeId=obj.content_type_id,
content=f"{PageCache.get(obj.id, lang='en-gb')}",
)
except Exception as e:
Expand All @@ -25,8 +29,8 @@ def get_cms_content_for_obj(self, obj):

def to_representation(self, obj):
return {
'id': ('dit:cmsContent:international:' + str(obj.id) + ':Update'),
'type': 'Update',
'id': f'{self.prefix}:{self.subtype}:{obj.id}:{self.operation}',
'type': self.operation,
'published': obj.last_published_at.isoformat(),
'object': self.get_cms_content_for_obj(obj),
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ tzdata==2023.3
# django-celery-beat
uritemplate==4.1.1
# via drf-spectacular
urllib3==1.26.16
urllib3==1.26.17
# via
# -r requirements.in
# botocore
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ tzdata==2023.3
# django-celery-beat
uritemplate==4.1.1
# via drf-spectacular
urllib3==1.26.16
urllib3==1.26.17
# via
# -r requirements.in
# botocore
Expand Down
10 changes: 5 additions & 5 deletions tests/activitystream/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def test_wagtail_page_serializer(international_site):
'type': 'dit:cmsContent',
'title': article.title,
'url': settings.APP_URL_GREAT_INTERNATIONAL+'content'+article.url,
'seo_title': article.seo_title,
'search_description': article.search_description,
'first_published_at': article.first_published_at.isoformat(),
'last_published_at': article.last_published_at.isoformat(),
'content_type_id': article.content_type_id,
'seoTitle': article.seo_title,
'searchDescription': article.search_description,
'firstPublishedAt': article.first_published_at.isoformat(),
'lastPublishedAt': article.last_published_at.isoformat(),
'contentTypeId': article.content_type_id,
'content': "None",
},
}
Expand Down

0 comments on commit 9198c06

Please sign in to comment.