Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update address export to include location name #839

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mep/accounts/management/commands/export_addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions mep/accounts/tests/test_accounts_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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