@@ -383,18 +383,24 @@ def write_import_report_template_sheet(workbook, monthly_report):
383
383
for plan in project .activityplan_set .all ():
384
384
cluster_code .extend (plan .activity_domain .clusters .values_list ("code" , flat = True ))
385
385
for location in plan .targetlocation_set .all ():
386
- plain_dictionary_lists ["indicatorList" ].append (str (plan .indicator .name ))
387
- plain_dictionary_lists ["activityDomainList" ].append (str (plan .activity_domain .name ))
388
- plain_dictionary_lists ["activityTypeList" ].append (str (plan .activity_type .name ))
389
- plain_dictionary_lists ["admin0pcodeList" ].append (str (location .country .code ))
390
- plain_dictionary_lists ["admin0nameList" ].append (str (location .country .name ))
391
- plain_dictionary_lists ["admin1nameList" ].append (str (location .province .name ))
392
- plain_dictionary_lists ["admin1pcodeList" ].append (str (location .province .code ))
393
- plain_dictionary_lists ["admin2pcodeList" ].append (str (location .district .code ))
394
- plain_dictionary_lists ["admin2nameList" ].append (str (location .district .name ))
395
- plain_dictionary_lists ["implementing_partner_list" ].append (str (location .implementing_partner .code ))
396
- plain_dictionary_lists ["non_hrp_beneficiary" ].append (str (plan .beneficiary ))
397
- plain_dictionary_lists ["hrp_beneficiary" ].append (str (plan .hrp_beneficiary ))
386
+ plain_dictionary_lists ["indicatorList" ].append (str (plan .indicator .name if plan .indicator else "" ))
387
+ plain_dictionary_lists ["activityDomainList" ].append (
388
+ str (plan .activity_domain .name if plan .activity_domain else "" )
389
+ )
390
+ plain_dictionary_lists ["activityTypeList" ].append (
391
+ str (plan .activity_type .name if plan .activity_type else "" )
392
+ )
393
+ plain_dictionary_lists ["admin0pcodeList" ].append (str (location .country .code if location .country else "" ))
394
+ plain_dictionary_lists ["admin0nameList" ].append (str (location .country .name if location .country else "" ))
395
+ plain_dictionary_lists ["admin1nameList" ].append (str (location .province .name if location .province else "" ))
396
+ plain_dictionary_lists ["admin1pcodeList" ].append (str (location .province .code if location .province else "" ))
397
+ plain_dictionary_lists ["admin2pcodeList" ].append (str (location .district .code if location .district else "" ))
398
+ plain_dictionary_lists ["admin2nameList" ].append (str (location .district .name if location .district else "" ))
399
+ plain_dictionary_lists ["implementing_partner_list" ].append (
400
+ str (location .implementing_partner .code if location .implementing_partner else "" )
401
+ )
402
+ plain_dictionary_lists ["non_hrp_beneficiary" ].append (str (plan .beneficiary if plan .beneficiary else "" ))
403
+ plain_dictionary_lists ["hrp_beneficiary" ].append (str (plan .hrp_beneficiary if plan .hrp_beneficiary else "" ))
398
404
num_rows += 1
399
405
400
406
container_dictionary ["reponseTypeList" ].extend (responseType )
0 commit comments