Skip to content

Enforcing model default ordering (#1495) may have been overzealous #1516

Closed
@gsvr

Description

@gsvr

#1495 - released in 3.2.1 forces every model in a project to have a default ordering specified.

The impact of this is not trivial:

  1. Each project using this will have to set ordering defaults on every model that a DjangoConnectionField is being applied to (in only one of my projects this is over 100 changes)
  2. Ordering is not a free operation (please see https://docs.djangoproject.com/en/5.0/ref/models/options/#ordering)

I do agree the problem raised in #1495 is a good catch, but I think a better approach to handling this could be:

  1. If there is no default ordering specified, use the models primary key as the default for sorting, since every model should have one (https://docs.djangoproject.com/en/5.0/topics/db/models/#automatic-primary-key-fields) and/or
  2. Warn the user of potential problems rather than enforcing model updates

Please feel free to disagree with me if I'm misunderstanding or overlooking something here, in the meantime I'm pinning to 3.2.0 😊

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions