Skip to content

Fix #53: Sort refs by start when displaying by lemma#54

Draft
johannesdewit wants to merge 1 commit into
mainfrom
53-references-order-in-workview
Draft

Fix #53: Sort refs by start when displaying by lemma#54
johannesdewit wants to merge 1 commit into
mainfrom
53-references-order-in-workview

Conversation

@johannesdewit
Copy link
Copy Markdown
Collaborator

Fix #53

<li>
<a href="{% url 'lemma-detail' lemma.slug %}">{{ lemma.display }}</a>:
{{ page_ref_list|join:', ' }}
{{ page_ref_list|dictsort:"start"|join:', ' }}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Op het PageReference model staat een ordering als volgt:

# models.py, l. 222
ordering = ["whole", "lemma", "work", "start", "end", "suffix"]

M.a.w.: er wordt in de database eerst op work gesorteerd, pas daarna op start. Dat is denk ik de oorzaak van #53, zou dat kunnen?

Ik zou wel willen kijken of we op dat niveau een oplossing kunnen bedenken, want het sorteren gaat op dat niveau wel een stuk efficiënter dan in de html templates. In het eerste geval sla je ze op een gesorteerde manier op, en heb je bij het ophalen altijd direct de sorting die je wil hebben, met deze oplossing worden elke keer bij het renderen alle dictionaries opnieuw gesorteerd (ook degene die al gesorteerd zijn).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ik denk dat je dit inderdaad zou moeten doen met database index.

Ik ga eens speuren.

@johannesdewit johannesdewit marked this pull request as draft March 9, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

References not displayed in order in workview if work has children.

2 participants