Skip to content
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

TypedModelMeta only allows list[str] for ordering #1846

Closed
HansAarneLiblik opened this issue Nov 17, 2023 · 1 comment · Fixed by #1847
Closed

TypedModelMeta only allows list[str] for ordering #1846

HansAarneLiblik opened this issue Nov 17, 2023 · 1 comment · Fixed by #1847
Labels
bug Something isn't working

Comments

@HansAarneLiblik
Copy link
Contributor

HansAarneLiblik commented Nov 17, 2023

Hi!

TypedModelMeta.ordering currently only allows a Sequence of str, but accoding to the docs, expressions like OrderBy should also be allowed

image

Example of valid input:

class Entry(models.Model):
  type = models.CharField(max_length=100)
  item = models.CharField(max_length=100, null=True)

  class Meta(TypedModelMeta):
    ordering = ["type", F("item").asc(nulls_first=True)]
@HansAarneLiblik HansAarneLiblik added the bug Something isn't working label Nov 17, 2023
@intgr
Copy link
Collaborator

intgr commented Nov 17, 2023

Yes. Are you interested in submitting a PR? 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants
@intgr @HansAarneLiblik and others