Skip to content

Commit a09578c

Browse files
committed
Include ordering attributes in WealthGroupCharacteristicValueSerializer - see HEA-772
1 parent 0a48f08 commit a09578c

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

apps/baseline/serializers.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,11 @@ class Meta:
358358
"wealth_group_category",
359359
"wealth_group_category_name",
360360
"wealth_group_category_description",
361+
"wealth_group_category_ordering",
361362
"wealth_characteristic",
362363
"wealth_characteristic_name",
363364
"wealth_characteristic_description",
365+
"wealth_characteristic_ordering",
364366
"variable_type",
365367
"characteristic_group",
366368
"product",
@@ -393,10 +395,14 @@ def get_wealth_group_label(self, obj):
393395
wealth_group_category_description = serializers.CharField(
394396
source="wealth_group.wealth_group_category.description", read_only=True
395397
)
398+
wealth_group_category_ordering = serializers.IntegerField(
399+
source="wealth_group.wealth_group_category.ordering", read_only=True
400+
)
396401
wealth_characteristic_name = serializers.CharField(source="wealth_characteristic.name", read_only=True)
397402
wealth_characteristic_description = serializers.CharField(
398403
source="wealth_characteristic.description", read_only=True
399404
)
405+
wealth_characteristic_ordering = serializers.IntegerField(source="wealth_characteristic.ordering", read_only=True)
400406
variable_type = serializers.CharField(source="wealth_characteristic.variable_type", read_only=True)
401407
livelihood_zone_baseline = serializers.IntegerField(
402408
source="wealth_group.community.livelihood_zone_baseline.pk", read_only=True
@@ -459,9 +465,11 @@ class Meta:
459465
"wealth_group_category",
460466
"wealth_group_category_name",
461467
"wealth_group_category_description",
468+
"wealth_group_category_ordering",
462469
"wealth_characteristic",
463470
"wealth_characteristic_name",
464471
"wealth_characteristic_description",
472+
"wealth_characteristic_ordering",
465473
"variable_type",
466474
"characteristic_group",
467475
"product",
@@ -494,10 +502,14 @@ def get_wealth_group_label(self, obj):
494502
wealth_group_category_description = serializers.CharField(
495503
source="wealth_group.wealth_group_category.description", read_only=True
496504
)
505+
wealth_group_category_ordering = serializers.IntegerField(
506+
source="wealth_group.wealth_group_category.ordering", read_only=True
507+
)
497508
wealth_characteristic_name = serializers.CharField(source="wealth_characteristic.name", read_only=True)
498509
wealth_characteristic_description = serializers.CharField(
499510
source="wealth_characteristic.description", read_only=True
500511
)
512+
wealth_characteristic_ordering = serializers.IntegerField(source="wealth_characteristic.ordering", read_only=True)
501513
variable_type = serializers.CharField(source="wealth_characteristic.variable_type", read_only=True)
502514
livelihood_zone_baseline = serializers.IntegerField(
503515
source="wealth_group.livelihood_zone_baseline.pk", read_only=True

apps/baseline/tests/test_viewsets.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,9 +1319,11 @@ def test_get_record(self):
13191319
"wealth_group_category",
13201320
"wealth_group_category_name",
13211321
"wealth_group_category_description",
1322+
"wealth_group_category_ordering",
13221323
"wealth_characteristic",
13231324
"wealth_characteristic_name",
13241325
"wealth_characteristic_description",
1326+
"wealth_characteristic_ordering",
13251327
"variable_type",
13261328
"characteristic_group",
13271329
"product",
@@ -1608,9 +1610,11 @@ def test_response_fields(self):
16081610
"wealth_group_category",
16091611
"wealth_group_category_name",
16101612
"wealth_group_category_description",
1613+
"wealth_group_category_ordering",
16111614
"wealth_characteristic",
16121615
"wealth_characteristic_name",
16131616
"wealth_characteristic_description",
1617+
"wealth_characteristic_ordering",
16141618
"variable_type",
16151619
"characteristic_group",
16161620
"product",

0 commit comments

Comments
 (0)