Skip to main content

Welcome to django-reorder-items-widget

Tests

Description

Reorder your items by simply dragging them to their new position. This works fine within admin changelists and inline formsets.

The main component is the ReorderItemsWidget which provides the drag and drop interface on top of an index field and updates the indexes of listed items on form submission.

Still there are some neccessary setups to make a full functional admin integration of the reorder items feature: we need a model field for the widget, an appropriate admin configuration and we probably do not want to update indexes manually when adding or removing items bypassing the widget. Therefore we use some signal handlers for the model field.

This app provides everything you need to make this setup as easy as possible.

Installation

Install via pip:

pip install django-reorder-items-widget

Add reorder_items_widget to your INSTALLED_APPS:

INSTALLED_APPS = [
    'reorder_items_widget',
    ...
]

Getting started

Setup for a reorderable changelist

Add a ReorderItemsField field to your model:

from django.db import models
from reorder_items_widget import ReorderItemsField

class Item(models.Model):
    ...
    index = models.ReorderItemsField()

    class Meta:
        ordering = ('index',)

Setup your model admin using the ReorderItemsModelAdmin:

from django.contrib import admin
from reorder_items_widget import ReorderItemsModelAdmin

class ItemModelAdmin(ReorderItemsModelAdmin):
    ...

You don't have to do anything with the index field in your model admin. It's already setup by the base class.

Now you can reorder your items within the changelist only by drag and drop. And completely forget about the index field which won't show up in the whole admin backend at all.

Setup for a reorderable inline

Again setup your models with a ReorderItemsField:

from django.db import models
from reorder_items_widget import ReorderItemsField

class Container(models.Model):
    ...

class Item(models.Model):
    ...
    index = models.ReorderItemsField(grouped_by=['container'])
    container = models.ForeignKey(Container, on_delete=models.CASCADE)

    class Meta:
        ordering = ('container', 'index')

Mind the grouped_by argument for the ReorderItemsField. This argument tells the field, that the ordering should be container specific. For each container object the indexes of the related items will start anew with zero.

Now setup the model admins using the ReorderItemsInline:

from django.contrib import admin
from reorder_items_widget import ReorderItemsInline

class ItemInline(ReorderItemsInline):
    ...

class ContainerModelAdmin(admin.ModelAdmin):
    inlines = (ItemInline,)

Again there is no need to handle the index field.

Now visit the changeform of your container object and enjoy reordering its items.

Caveats

The widget will always number your items sequentially. So reordering a filtered list of items might have unexpected results. Paging however should not be a problem since the index of the first listed item will be used as a base.

Contribute

Feedback, feature requests, bug reports or pull requests are most welcome. Just use the common github infrastructure.

Metadata

Release files for django-reorder-items-widget 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-reorder-items-widget 1.2.1
File Size Uploaded Provenance Actions
django_reorder_items_widget-1.2.1.tar.gz 10.2 kB With provenance Details for django_reorder_items_widget-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-reorder-items-widget 1.2.1
File Interpreter ABI Platform Actions
django_reorder_items_widget-1.2.1-py3-none-any.whl Python 3 none any Details for django_reorder_items_widget-1.2.1-py3-none-any.whl

Total release size: 23.3 kB

Release files / django_reorder_items_widget-1.2.1.tar.gz

Download URL django_reorder_items_widget-1.2.1.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1926534c6e62f60c6eca3167a5f6a8833e0f2cdab4701ee2ba5da6cbf6cb4bb5
BLAKE2b-256 checksum
How to use checksums
5810e512646d448cf9a6231b5ae5232f62f20d4a0a429e8bb35cca47dcc17b50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / django_reorder_items_widget-1.2.1-py3-none-any.whl

Download URL django_reorder_items_widget-1.2.1-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9602eaa97fc6449818a373ce36d261db9d9df26193b4e930f8d77c70605456ab
BLAKE2b-256 checksum
How to use checksums
10af36cc544b7aadf20ba6f73c1b4471dfdf849e1d1edc52e54cbb67f3ce56de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for django-reorder-items-widget 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_reorder_items_widget-1.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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