Hi, i receive an xml file and i am parsing the values and sving them to database.
> XML Example: <property>...</property> <property>...</property> <property>...</property> <property> <id>9896</id> <date>2019-07-11 13:12:09</date> <ref>BC30401</ref> <price>895000</price> <currency>EUR</currency> <price_freq>sale</price_freq> <part_ownership>0</part_ownership> <leasehold>0</leasehold> <new_build>0</new_build> <surface_area> <built>915</built> </surface_area> <type>Villa</type> <location> <latitude>37.134720</latitude> <longitude>-8.020436</longitude> </location> <location_detail>optional location detail</location_detail> <town>Vilamoura</town> <province>Algarve</province> <country>Portugal</country> <beds>4</beds> <baths>3</baths> <pool>1</pool> <images> <image id="1"> <url> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7064.jpg </url> </image> <image id="2"> <url> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7065.jpg </url> </image> <image id="3"> <url> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7066.jpg </url> </image> <image id="4"> <url> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7067.jpg </url> </image> <image id="5"> <url> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7068.jpg </url> </image> <image id="6"> <url> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7069.jpg </url> </image> <image id="7"> <url> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7071.jpg </url> </image> <image id="8"> <url> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7072.jpg </url> </image> <image id="9"> <url> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7073.jpg </url> </image> <image id="10"> <url> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7075.jpg </url> </image> <image id="11"> <url> https://bc-villas.com/wp-content/uploads/2019/07/IMG_7077.jpg </url> > </image> It´s all working ok but with images its a litle confused because i can only save the first and the last image. If a property have 12 pictures i can only save the picture nr 1 and picture nr 12, if the property have 8 pictures i can only save picture nr1 and picture nr 8. It´s weird! My code to get the pictures url: img = props.find('images') for child in img: if child.get('id') == '1': img_main_url = child.find('url').text if child.get('id') == '2': img_1_url = child.find('url').text else: img_1_url = None if child.get('id') == '3': img_2_url = child.find('url').text else: img_2_url = None if child.get('id') == '4': img_3_url = child.find('url').text else: img_3_url = None if child.get('id') == '5': img_4_url = child.find('url').text else: img_4_url = None I could use a litle help from someone more experienced in django. Thanks for your help -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9605acae-a45c-4ac2-b182-ef7f20659db2%40googlegroups.com.