Skip to content

Commit

Permalink
Return full thumbail image in api
Browse files Browse the repository at this point in the history
  • Loading branch information
dimasciput committed Jul 18, 2023
1 parent 98041b0 commit 16cfed7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions qgis-app/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ResourceBaseSerializer(serializers.ModelSerializer):
creator = serializers.ReadOnlyField(source="get_creator_name")
resource_type = serializers.SerializerMethodField()
resource_subtype = serializers.SerializerMethodField()
thumbnail_full = serializers.ImageField(source="thumbnail_image")

# A thumbnail image, sorl options and read-only
thumbnail = HyperlinkedSorlImageField(
Expand All @@ -28,6 +29,7 @@ class Meta:
"description",
"file",
"thumbnail",
"thumbnail_full"
]

def validate(self, attrs):
Expand Down
2 changes: 2 additions & 0 deletions qgis-app/api/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ def test_get_list_resources(self):
self.assertEqual(result[s_index]["resource_type"], "Style")
self.assertEqual(result[s_index]["resource_subtype"], "Marker")
self.assertEqual(result[s_index]["creator"], "creator")
self.assertIsNotNone(result[s_index]["thumbnail"])
self.assertIsNotNone(result[s_index]["thumbnail_full"])

def test_get_list_resources_with_filter(self):
param = "resource_type=geopackage"
Expand Down
6 changes: 6 additions & 0 deletions qgis-app/static/bootstrap/js/bootstrap-3.4.1.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion qgis-app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link rel="shortcut icon" href="{% static "images/favicon.ico" %}"/>

<script type="text/javascript" src="{% static "js/jquery-1.11.1.min.js" %}"></script>
<script type="text/javascript" src="{% static "bootstrap/js/bootstrap.min.js" %}"></script>
<script type="text/javascript" src="{% static "bootstrap/js/bootstrap-3.4.1.min.js" %}"></script>

<!-- Cookie disclaimer -->
<script type="text/javascript" id="cookieinfo" src="{% static 'js/cookieinfo/cookieinfo.min.js' %}" data-bg="#1c2028"
Expand Down

0 comments on commit 16cfed7

Please sign in to comment.