Skip to content

Allow descending order of items - #40

Open
th3hamm0r wants to merge 1 commit into
elton2048:masterfrom
th3hamm0r:feature/allow-descending-order
Open

Allow descending order of items#40
th3hamm0r wants to merge 1 commit into
elton2048:masterfrom
th3hamm0r:feature/allow-descending-order

Conversation

@th3hamm0r

Copy link
Copy Markdown
Contributor

Currently, the model can only be sorted ascending. With that change, you can now use the "-" prefix, e.g. on the model's Meta, to use descending order. For example:

from django.db import models
from wagtailorderable.models import Orderable

class YourModel(Orderable):
    ...
    class Meta:
        ordering = ["-sort_order"]

This PR also includes the following improvements:

  • Try to use the model's default ordering from the Meta class, if the Modeladmin does not define one.
  • Cleanup: Removed get_ordering(), since the OrderableMixinMetaClass already ensures, that the sort column is part of the ordering.

This change also includes the following improvements:
* Try to use the model's default ordering from the Meta class, if the
  Modeladmin does not define one.
* Cleanup: Removed get_ordering(), since the OrderableMixinMetaClass
  already ensures, that the sort column is part of the ordering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant