Skip to main content

A Wagtail app for drag-and-drop ordering for objects in the admin interface

Project description

wagtail-modeladmin-sortable

Generic drag-and-drop ordering for objects in the Wagtail admin interface

Quick start

Install wagtail_modeladmin_sortable

$ pip install wagtail-modeladmin-sortable

Add wagtail_modeladmin_sortable to INSTALLED_APPS the settings of your Django project:

INSTALLED_APPS = [
  ...
  'wagtail_modeladmin_sortable',
]

Integrate your models

from django.db import models
from wagtail_modeladmin_sortable.models import AdminSortable


class Example(AdminSortable):
    title = models.CharField('Title', max_length=255, null=True, blank=True)

    class Meta(AdminSortable.Meta):
        verbose_name = "Example"
        verbose_name_plural = "Examples"

In wagtail_hooks.py, add a mixin class to augment the functionality for sorting (be sure to put the mixin class before ModelAdmin):

from wagtail.contrib.modeladmin.options import ModelAdmin
from wagtail_modeladmin_sortable.mixins import ModelAdminSortableMixin


class ExampleAdmin(ModelAdminSortableMixin, ModelAdmin):
    pass
License

Copyright © 2021 Stanislav Lazarov.

MIT licensed.

Project details


Download files

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

Source Distribution

wagtail-modeladmin-sortable-0.0.2.tar.gz (107.5 kB view details)

Uploaded Source

File details

Details for the file wagtail-modeladmin-sortable-0.0.2.tar.gz.

File metadata

  • Download URL: wagtail-modeladmin-sortable-0.0.2.tar.gz
  • Upload date:
  • Size: 107.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

File hashes

Hashes for wagtail-modeladmin-sortable-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b07daeb268d44e662c1d0227c81f440d2155cc34a85a94f9d4193deddd163e7f
MD5 f3786e71502901ebf6bef28c757b7c7c
BLAKE2b-256 f06214c9c2d2ba53e23b3d3656df0a6225ad4e0775c486b1b3146b655f1c7e6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page