Skip to content
This repository has been archived by the owner on Jun 6, 2019. It is now read-only.

Commit

Permalink
Merge pull request #117 from edx/jsa/banner-image-url-keys
Browse files Browse the repository at this point in the history
Fix banner image url keys in programs API response
  • Loading branch information
Jim Abramson committed Apr 6, 2016
2 parents 40ab973 + 39bfd76 commit 776503e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion programs/apps/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def get_banner_image_urls(self, instance):
url_items = instance.banner_image.resized_urls.items()
# in case MEDIA_URL does not include scheme+host, ensure that the URLs are absolute and not relative
url_items = [[size, self.context['request'].build_absolute_uri(url)] for size, url in url_items]
return {'{}x{}'.format(*size): url for size, url in url_items}
return {'w{}h{}'.format(*size): url for size, url in url_items}

def create(self, validated_data):
"""
Expand Down
2 changes: 1 addition & 1 deletion programs/apps/api/v1/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def assert_correct_banner_image_urls(self, url_prepend=''):
self.assertEqual(response.status_code, 200)

expected_urls = {
'{}x{}'.format(*size): '{}{}__{}x{}.jpg'.format(url_prepend, program.banner_image.url, *size)
'w{}h{}'.format(*size): '{}{}__{}x{}.jpg'.format(url_prepend, program.banner_image.url, *size)
for size in program.banner_image.field.sizes
}
self.assertEqual(response.data[u'banner_image_urls'], expected_urls)
Expand Down

0 comments on commit 776503e

Please sign in to comment.