go-frontend
go-frontend copied to clipboard
[PROD] Order by a field which is display-only and not orderable
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.)
CC: @k9845 @samshara