testing notes (QA)
On the staging site:
- Open up the admin people module
- Click into Nahray ben Nissim's
- Click "DOWNLOAD RELATIONS AS CSV" button at the top right corner
dev notes
- In
PersonRelationsExporter.populate_relation_fields, currently url and admin_url are populated if rel[TYPE] == "Document".
- We'll need to add those to the
Person and Place rel[TYPE] blocks as well, just replacing the URLs with ones for public person or place URLs, and the admin edit forms for them.
- However, people and places use slugs instead of IDs for public URLs. Because of that, we'll need to grab the slugs from the db. The most efficient way to do this is probably something like this, where we grab just the id and slug from the db and put them into a dict keyed on id, before looping over the related objects:
places_qs = Place.objects.filter(id__in=related_places).values("id", "slug")
places_slug_dict = {p["id"]: p["slug"] for p in places_qs}
people_qs = Person.objects.filter(id__in=related_people).values("id", "slug")
people_slug_dict = {p["id"]: p["slug"] for p in people_qs}
Then you can just call places_slug_dict.get(rel[ID]) and people_slug_dict.get(rel[ID]) within the loop, to get the slugs and slot them into the public URLs.
- For the events, since events don't have frontend pages, just populate
admin_url.
Describe the solution you'd like
In the individual person downloads, I want there to be two addition columns for the admin and public URLS of the listed place records.
Additional context
Related to #1945, #1969, #1970.
testing notes (QA)
On the staging site:
dev notes
PersonRelationsExporter.populate_relation_fields, currentlyurlandadmin_urlare populated ifrel[TYPE] == "Document".PersonandPlacerel[TYPE]blocks as well, just replacing the URLs with ones for public person or place URLs, and the admin edit forms for them.places_slug_dict.get(rel[ID])andpeople_slug_dict.get(rel[ID])within the loop, to get the slugs and slot them into the public URLs.admin_url.Describe the solution you'd like
In the individual person downloads, I want there to be two addition columns for the admin and public URLS of the listed place records.
Additional context
Related to #1945, #1969, #1970.