Skip to content

Commit

Permalink
[#1749] Check if partnership has organisation in IATI export
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Aug 20, 2015
1 parent e19918f commit b1810d6
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions akvo/iati/elements/participating_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,25 @@ def participating_org(project):

for partnership in project.partnerships.all():
org = partnership.organisation
element = etree.Element("participating-org")
if org:
element = etree.Element("participating-org")

if org.iati_org_id:
element.attrib['ref'] = org.iati_org_id
if org.iati_org_id:
element.attrib['ref'] = org.iati_org_id

if org.new_organisation_type:
element.attrib['type'] = str(org.new_organisation_type)
if org.new_organisation_type:
element.attrib['type'] = str(org.new_organisation_type)

if partnership.partner_type in TYPE_TO_CODE.keys():
element.attrib['role'] = TYPE_TO_CODE[partnership.partner_type]
if partnership.partner_type in TYPE_TO_CODE.keys():
element.attrib['role'] = TYPE_TO_CODE[partnership.partner_type]

narrative_element = etree.SubElement(element, "narrative")
narrative_element = etree.SubElement(element, "narrative")

if org.long_name:
narrative_element.text = org.long_name
elif org.name:
narrative_element.text = org.name
if org.long_name:
narrative_element.text = org.long_name
elif org.name:
narrative_element.text = org.name

partnership_elements.append(element)
partnership_elements.append(element)

return partnership_elements

0 comments on commit b1810d6

Please sign in to comment.