Code

Opened 6 years ago

Closed 3 years ago

#6786 closed New feature (wontfix)

Ordering choices after translation

Reported by: David Avsajanishvili <avsd05@…> Owned by: nobody
Component: Core (Other) Version: master
Severity: Normal Keywords: order choices field
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Added order parameter to constructor of db.models.Field class, that specifies ordering of choices list.
Ordering is performed after translation, so localized lists are ordered correctly.

The ordering was tested successfully both on CharField with choices and ForeignKey field.

Attachments (2)

choices_order.diff (4.0 KB) - added by David Avsajanishvili <avsd05@…> 6 years ago.
changes in db.models.Field constructor and it's docs
choices_sort.diff (3.9 KB) - added by David Avsajanishvili <avsd05@…> 6 years ago.
Renamed parameter "order" to "sort"

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by David Avsajanishvili <avsd05@…>

changes in db.models.Field constructor and it's docs

Changed 6 years ago by David Avsajanishvili <avsd05@…>

Renamed parameter "order" to "sort"

comment:1 Changed 6 years ago by David Avsajanishvili <avsd05@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Renamed parameter from "order" to "sort"
and tested the system again.
Everything is working!

comment:2 Changed 6 years ago by David Avsajanishvili <avsd05@…>

  • Has patch set
  • Needs tests set
  • Triage Stage changed from Unreviewed to Design decision needed

comment:3 Changed 3 years ago by julien

  • Severity set to Normal
  • Type set to New feature

comment:4 Changed 3 years ago by Alex

  • Easy pickings unset
  • Resolution set to wontfix
  • Status changed from new to closed
  • UI/UX unset

Discussion with Carl: sorting choices for display is not a model-level concern, it is a form-level concern and this solves it at the right level. the right solution is for forms that want to display choices in a different order to override init and resort their field's choices.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.