Skip to main content
CI Status

Please refer to the CI build linked above for the currently supported combinations of Python and Django.

Installation

pip install django-admin-ordering, and add admin_ordering to INSTALLED_APPS.

Usage

First, you need a model ordered by an integer field. If you are happy with a model where 1. the ordering field is called ordering and 2. the ordering field is automatically initialized so that new objects are ordered last you can also inherit the abstract admin_ordering.models.OrderableModel model. If you define your own class Meta you should inherit OrderableModel.Meta so that the ordering attribute is set to the correct value:

from admin_ordering.models import OrderableModel

class MyModel(OrderableModel):
    # ...

    class Meta(OrderableModel.Meta):
        # ...

Orderable change lists

from admin_ordering.admin import OrderableAdmin

@admin.register(MyModel)
class MyModelAdmin(OrderableAdmin, admin.ModelAdmin):
    # The field used for ordering. Prepend a minus for reverse
    # ordering: "-ordering"
    # Doesn't have to be provided as long as you're using the default.
    # ordering_field = "ordering"

    # You may optionally hide the ordering field in the changelist:
    # ordering_field_hide_input = False

    # You may optionally add up/down arrows to reorder by click instead of dragging:
    # ordering_field_up_down_arrows = True

    # The ordering field can optionally be automatically renumbered when
    # the page loads. This may be useful if you have existing data which
    # isn't ordered yet.
    # ordering_field_renumber_on_load = False

    # The ordering field must be included both in list_display and
    # list_editable:
    list_display = ["name", "ordering"]
    list_editable = ["ordering"]

Orderable inlines

from admin_ordering.admin import OrderableAdmin

class MyModelTabularInline(OrderableAdmin, admin.TabularInline):
    model = MyModel

    # Same as above; "-ordering" is also allowed here:
    # ordering_field = "ordering"
    # ordering_field_hide_input = False
    # ordering_field_up_down_arrows = False
    # ordering_field_renumber_on_load = False

OrderableAdmin comes with a default of extra = 0 (no extra empty inlines shown by default). It is strongly recommended to leave the changed default as-is, because otherwise you’ll end up with invalid inlines just because you wanted to change the ordering.

Limitations

  • OrderableAdmin can be used both for inlines and parents, but this also means that you cannot register a model directly with OrderableAdmin.

  • Using django-admin-ordering with filtered or paginated lists may produce unexpected results. The recommendation right now is to set list_per_page to a bigger value and not reordering filtered changelists.

  • Note that django-admin-ordering assigns ordering values in increments of 10, emphasizing that the ordering value should not have any significance apart from giving relative ordering to elements.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_admin_ordering-0.21.0.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_admin_ordering-0.21.0-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file django_admin_ordering-0.21.0.tar.gz.

File metadata

  • Download URL: django_admin_ordering-0.21.0.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_admin_ordering-0.21.0.tar.gz
Algorithm Hash digest
SHA256 f4474117fc8dcba55975a9a80682bd0a4baefa5c45be0f0e8ceb62daa95cf8f8
MD5 cce33bf91735ea751a47ab16c21512ea
BLAKE2b-256 3f5d758fff2e69e3af15fd67007a0061bbea8ff19452e832f9394f5d7467a45c

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_admin_ordering-0.21.0.tar.gz:

Publisher: publish.yml on feincms/django-admin-ordering

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_admin_ordering-0.21.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_ordering-0.21.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4976c1f0f756c5bad42fa1c915c3b8e9efd5d0d1294a794c4a72691c4f56b5df
MD5 a72539e8b68a4e12904ba1ab1cf6dad8
BLAKE2b-256 54cade07105e282ce0393f8a7f85cc45456626a773defea18792745d96d5f561

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_admin_ordering-0.21.0-py3-none-any.whl:

Publisher: publish.yml on feincms/django-admin-ordering

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.21.0 This release

2 files

0.20.0

2 files

0.19.1

2 files

0.19.0

2 files

0.18.2

2 files

0.18.1

2 files

0.18.0

2 files

0.17.0

2 files

0.16.1

2 files

0.16.0

2 files

0.15.0

2 files

0.14.2

2 files

0.14.1

2 files

0.14.0

2 files

0.13.1

2 files

0.13.0

2 files

0.12.0

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.1

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page