Skip to main content
Help us improve Python packaging – donate today!

Allows Django models to be ordered and provides a simple admin interface for reordering them.

Project Description

[![Build Status](https://secure.travis-ci.org/bfirsh/django-ordered-model.png?branch=master)](https://travis-ci.org/bfirsh/django-ordered-model)

django-ordered-model allows models to be ordered and provides a simple admin interface for reordering them.

Based on http://www.djangosnippets.org/snippets/998/ and http://www.djangosnippets.org/snippets/259/

Requires:

  • Django 1.4

Installation

$ python setup.py install

Usage

Add ordered_model to your SETTINGS.INSTALLED_APPS.

Inherit your model from OrderedModel to make it ordered:

from django.db import models from ordered_model.models import OrderedModel

class Item(OrderedModel):

name = models.CharField(max_length=100)

class Meta(OrderedModel.Meta):
pass

Model instances now have move_up() and move_down() methods to move them relative to each other.

To add arrows in the admin change list page to do reordering, you can use the OrderedModelAdmin and the move_up_down_links field:

from django.contrib import admin from ordered_model.admin import OrderedModelAdmin from models import Item

class ItemAdmin(OrderedModelAdmin):
list_display = (‘name’, ‘move_up_down_links’)

admin.site.register(Item, ItemAdmin)

Test suite

$ ./run_tests.sh

Release history Release notifications

History Node

1.4.3

History Node

1.4.2

History Node

1.4.1

History Node

1.4.0

History Node

1.3.0

History Node

1.2.1

History Node

1.2.0

History Node

1.1.0

History Node

1.0.0

History Node

0.4.2

History Node

0.4.1

History Node

0.4.0

This version
History Node

0.3.0

History Node

0.2.0

History Node

0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django-ordered-model-0.3.0.tar.gz (5.8 kB) Copy SHA256 hash SHA256 Source None Oct 25, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page