Skip to content

Closes #17841 Allows Tags to be displayed in specified order #18930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

jnovinger
Copy link
Member

@jnovinger jnovinger commented Mar 17, 2025

Fixes: #17841

  • Adds Tag.weight field so users can specify an ordering weight. Valid values are 0-32767.
  • Sets default Tag ordering to ('weight', 'name') so that weights are used for ordering first (lower weights get sorted first) and then names for tie breakers.
  • Sets default TaggingMixin.tags ordering to ('weight', 'name') so that weights are used for ordering first (lower weights get sorted first) and then names for tie breakers. Note: this was required so that calls through an objects .tags related manager would be sorted when called from a template (e.g. so that ordering would work for things like {% for tag in Tag.objects.all %})
  • Updates existing tests and adds tests for default model ordering and related manager ordering defaults.
  • Adds Tag.weight in all the required places.

@jnovinger jnovinger requested review from a team and arthanson and removed request for a team March 17, 2025 22:01
Copy link
Collaborator

@arthanson arthanson left a comment

Choose a reason for hiding this comment

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

Good work @jnovinger everything looks good.

@arthanson arthanson merged commit 6b7d23d into feature Mar 19, 2025
6 checks passed
@jnovinger jnovinger deleted the 17841-custom-tag-ordering branch March 19, 2025 17:56
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants