Skip to content

TypedModelMeta only allows list[str] for ordering #1846

Closed
@HansAarneLiblik

Description

@HansAarneLiblik

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)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions