Skip to content

Commit 7a6ed07

Browse files
authored
Include missing fields to xlsx serializer (#40)
1 parent 9abb478 commit 7a6ed07

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

vbos/datasets/serializers.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ def to_representation(self, instance):
135135

136136

137137
class TabularItemExcelSerializer(serializers.ModelSerializer):
138+
province = serializers.ReadOnlyField(source="province.name")
139+
area_council = serializers.ReadOnlyField(source="area_council.name")
140+
138141
# Dynamically add fields based on all possible keys in the data
139142
def __init__(self, *args, **kwargs):
140143
super().__init__(*args, **kwargs)
@@ -158,4 +161,11 @@ def __init__(self, *args, **kwargs):
158161

159162
class Meta:
160163
model = TabularItem
161-
fields = ["id"]
164+
fields = [
165+
"id",
166+
"attribute",
167+
"date",
168+
"value",
169+
"province",
170+
"area_council",
171+
]

0 commit comments

Comments
 (0)