Skip to content

As a content editor, I want the csv of people-place relations to include admin and public URLs of the place pages so that I can easily click into the records from the csv #1971

@kseniaryzhova

Description

@kseniaryzhova

testing notes (QA)

On the staging site:

  1. Open up the admin people module
  2. Click into Nahray ben Nissim's
  3. Click "DOWNLOAD RELATIONS AS CSV" button at the top right corner
  • Verify the downloaded CSV has correct url link populated for each person-place relationship
  • Verify the downloaded CSV has correct admin_url link populated for each person-place relationship

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions