Skip to content
This repository was archived by the owner on Sep 4, 2024. It is now read-only.

[PROD] Order by a field which is display-only and not orderable #2838

Open
szabozoltan69 opened this issue Jun 22, 2023 · 1 comment
Open
Assignees
Labels

Comments

@szabozoltan69
Copy link
Contributor

szabozoltan69 commented Jun 22, 2023

Issue

Thanks @batpad for analyzing the related Sentry issue!

On frontend, when a user choses format=csv and ordering=get_record_type_display – will cause a backend failure, since of course the backend cannot query results with "order by get_record_type_display". We cannot really order by this column since it's only for display. Should be converted to "order by record_type" before the request is sent.

On frontend I did nod find the source of this issue, but on backend it can be reproduced in local dev env via a
curl http://localhost:8000/api/v2/country/?format=csv&ordering=get_record_type_display
request.

(The same situation occurs in event_snippet, order by -get_visibility_display. Instead: visibility | Or /api/v2/appeal order by event. Instead: appeal__event, because /api/v2/appeal in reality uses appealhistory.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants