diff --git a/mep/accounts/management/commands/export_addresses.py b/mep/accounts/management/commands/export_addresses.py index cb895882..9b27f866 100644 --- a/mep/accounts/management/commands/export_addresses.py +++ b/mep/accounts/management/commands/export_addresses.py @@ -95,6 +95,7 @@ def get_object_data(self, obj): care_of_person_id=obj.care_of_person.slug if obj.care_of_person else None, care_of_person_name=obj.care_of_person.name if obj.care_of_person else None, # Location data + location_name=loc.name.strip(), street_address=loc.street_address, city=loc.city, postal_code=loc.postal_code, diff --git a/mep/accounts/tests/test_accounts_commands.py b/mep/accounts/tests/test_accounts_commands.py index 8ae9dddc..875f54c6 100644 --- a/mep/accounts/tests/test_accounts_commands.py +++ b/mep/accounts/tests/test_accounts_commands.py @@ -670,6 +670,8 @@ def test_get_object_data(self): assert gay_data["start_date"] == "1919-01-01" assert gay_data["end_date"] == "1930-01-01" assert gay_data["care_of_person_id"] == "hemingway" + # location does not have a name + assert gay_data["location_name"] == "" # without dates self.cmd.include_dates = False @@ -684,3 +686,10 @@ def test_get_object_data(self): assert gay_data["members"][0]["sort_name"] == "Gay, Francisque" assert gay_data["care_of_person_id"] == "hemingway" assert gay_data["care_of_person_name"] == "Ernest Hemingway" + + # add a location name to confirm it is included + loc = address.location + loc.name = "Le Hotel" + loc.save() + gay_data = self.cmd.get_object_data(address) + assert gay_data["location_name"] == loc.name