@@ -47,10 +47,16 @@ class Meta:
47
47
48
48
class EarlyActionIndicatorSerializer (serializers .ModelSerializer ):
49
49
indicator_display = serializers .CharField (source = 'get_indicator_display' , read_only = True )
50
+ # indicator_display = serializers.SerializerMethodField('get_indicator_display')
50
51
51
52
class Meta :
52
53
model = EarlyActionIndicator
53
- fields = ('__all__' )
54
+ fields = '__all__'
55
+ # exclude = ('indicator_value',)
56
+
57
+ # @staticmethod
58
+ # def get_indicator_display(obj):
59
+ # return obj.indicator
54
60
55
61
56
62
class ActionSerializer (serializers .ModelSerializer ):
@@ -109,14 +115,14 @@ class EAPSerializer(
109
115
serializers .ModelSerializer
110
116
):
111
117
country_details = CountrySerializer (source = 'country' , read_only = True )
112
- district_details = MiniDistrictSerializer (source = 'district' , read_only = True )
118
+ districts_details = MiniDistrictSerializer (source = 'districts' , many = True , read_only = True )
113
119
references = EAPReferenceSerializer (source = 'eap_reference' , many = True , required = False )
114
120
partners = EAPPartnerSerializer (source = 'eap_partner' , many = True , required = False )
115
121
early_actions = EarlyActionSerializer (many = True )
116
122
created_by_details = UserNameSerializer (source = 'created_by' , read_only = True )
117
123
modified_by_details = UserNameSerializer (source = 'modified_by' , read_only = True )
118
124
hazard_type_details = DisasterTypeSerializer (source = 'disaster_type' , read_only = True )
119
- document_details = EAPDocumentSerializer (source = 'document' , read_only = True , required = False )
125
+ documents_details = EAPDocumentSerializer (source = 'documents' , many = True , read_only = True , required = False )
120
126
status_display = serializers .CharField (source = 'get_status_display' , read_only = True )
121
127
122
128
class Meta :
@@ -187,7 +193,7 @@ class EAPActivationReportSerializer(
187
193
operational_plans = OperationalPlanSerializer (many = True )
188
194
created_by_details = UserNameSerializer (source = 'created_by' , read_only = True )
189
195
modified_by_details = UserNameSerializer (source = 'modified_by' , read_only = True )
190
- document_details = EAPDocumentSerializer (source = 'document ' , read_only = True , many = True , required = False )
196
+ document_details = EAPDocumentSerializer (source = 'documents ' , read_only = True , many = True , required = False )
191
197
ifrc_financial_report_details = EAPDocumentSerializer (source = 'ifrc_financial_report' , read_only = True )
192
198
193
199
class Meta :
0 commit comments