{ "info": { "author": "Grigoriy Bezyuk", "author_email": "me@gbezyuk.ru", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "django-ordered-model-grappelli\n==============================\n\n[![Build Status](https://secure.travis-ci.org/gbezyuk/django-ordered-model-grappelli.png?branch=master)](https://travis-ci.org/gbezyuk/django-ordered-model-grappelli)\n\nThis is a fork of original django-ordered-model by bfirsh. Text bellow is left unchanged.\n\ndjango-ordered-model allows models to be ordered and provides a simple admin\ninterface for reordering them.\n\nBased on https://djangosnippets.org/snippets/998/ and\nhttps://djangosnippets.org/snippets/259/\n\nRequires:\n\n * Django >=1.5\n\nInstallation\n------------\n\n $ python setup.py install\n\nUsage\n-----\n\nAdd `ordered_model` to your `SETTINGS.INSTALLED_APPS`.\n\nInherit your model from `OrderedModel` to make it ordered:\n\n from django.db import models\n from ordered_model.models import OrderedModel\n\n class Item(OrderedModel):\n name = models.CharField(max_length=100)\n\n class Meta(OrderedModel.Meta):\n pass\n\nModel instances now have a set of methods to move them relative to each other.\nTo demonstrate those methods we create two instances of `Item`:\n\n foo = Item.objects.create(name=\"Foo\")\n bar = Item.objects.create(name=\"Bar\")\n\n### Swap positions\n\n foo.swap(bar)\n\nThis swaps the position of two objects.\n\n### Move position up on position\n\n foo.up()\n foo.down()\n\nMoving an object up or down just makes it swap its position with the neighouring\nobject directly above of below depending on the direction.\n\n### Move to arbitrary position\n\n foo.to(12)\n bar.to(13)\n\nMove the object to an arbitrary position in the stack. This essentially sets the\norder value to the specified integer. Objects between the original and the new\nposition get their order value increased or decreased according to the direction\nof the move.\n\n### Move object above or below reference\n\n foo.above(bar)\n foo.below(bar)\n\nMove the object directly above or below the reference object, increasing or\ndecreasing the order value for all objects between the two, depending on the\ndirection of the move.\n\n### Move to top of stack\n\n foo.top()\n\nThis sets the order value to the lowest value found in the stack and increases\nthe order value of all objects that were above the moved object by one.\n\n### Move to bottom of stack\n\n foo.bottom()\n\nThis sets the order value to the highest value found in the stack and decreases\nthe order value of all objects that were below the moved object by one.\n\n## Subset Ordering\n\nIn some cases, ordering objects is required only on a subset of objects. For example,\nan application that manages contact lists for users, in a many-to-one/many relationship,\nwould like to allow each user to order their contacts regardless of how other users\nchoose their order. This option is supported via the `order_with_respect_to` parameter.\n\nA simple example might look like so:\n\n class Contact(OrderedModel):\n user = models.ForeignKey(User)\n phone = models.CharField()\n order_with_respect_to = 'user'\n\n\nAdmin integration\n-----------------\n\nTo add arrows in the admin change list page to do reordering, you can use the\n`OrderedModelAdmin` and the `move_up_down_links` field:\n\n from django.contrib import admin\n from ordered_model.admin import OrderedModelAdmin\n from models import Item\n\n class ItemAdmin(OrderedModelAdmin):\n list_display = ('name', 'move_up_down_links')\n\n admin.site.register(Item, ItemAdmin)\n\n\nTest suite\n----------\n\nRequires Docker.\n\n $ script/test\n\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/gbezyuk/django-ordered-model-grappelli", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-ordered-model-grappelli", "package_url": "https://pypi.org/project/django-ordered-model-grappelli/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-ordered-model-grappelli/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/gbezyuk/django-ordered-model-grappelli" }, "release_url": "https://pypi.org/project/django-ordered-model-grappelli/1.0.1/", "requires_dist": null, "requires_python": null, "summary": "Allows Django models to be ordered and provides a simple admin interface for reordering them.", "version": "1.0.1" }, "last_serial": 1848762, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "6db7058f66c711ba82074249d6370d09", "sha256": "6f1fb65e53a32e5e1d1ff91a529e2114da3b943a517c2844a30be171e4649cf2" }, "downloads": -1, "filename": "django-ordered-model-grappelli-1.0.1.tar.gz", "has_sig": false, "md5_digest": "6db7058f66c711ba82074249d6370d09", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9798, "upload_time": "2015-12-06T14:51:35", "url": "https://files.pythonhosted.org/packages/1a/c0/ed249745335bea7dcfc74d4a10007b338cbf2ffd9f17ec38e6e2c5eb10fe/django-ordered-model-grappelli-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6db7058f66c711ba82074249d6370d09", "sha256": "6f1fb65e53a32e5e1d1ff91a529e2114da3b943a517c2844a30be171e4649cf2" }, "downloads": -1, "filename": "django-ordered-model-grappelli-1.0.1.tar.gz", "has_sig": false, "md5_digest": "6db7058f66c711ba82074249d6370d09", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9798, "upload_time": "2015-12-06T14:51:35", "url": "https://files.pythonhosted.org/packages/1a/c0/ed249745335bea7dcfc74d4a10007b338cbf2ffd9f17ec38e6e2c5eb10fe/django-ordered-model-grappelli-1.0.1.tar.gz" } ] }