This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sat Nov 14 20:31:25 -0800 2009 | |
| |
AUTHORS | Mon Nov 16 08:52:44 -0800 2009 | |
| |
LICENSE | Mon Jul 14 23:42:47 -0700 2008 | |
| |
README | Mon Nov 16 08:59:09 -0800 2009 | |
| |
positions/ | Mon Nov 16 08:50:55 -0800 2009 | |
| |
setup.py | Mon Nov 16 08:59:53 -0800 2009 |
README
================ Django Positions ================ This module provides ``PositionField``, a model field for Django_ that allows instances of a model to be sorted by a user-specified position. Conceptually, the field works like a list index: when the position of one item is changed, the positions of other items in the collection are updated in response. Usage ----- Add a ``PositionField`` to your model; that's just about it. If you want to work with all instances of the model as a single collection, there's nothing else required. To create collections based on one or more fields on the model, set ``unique_for_fields`` to a list containing the names of the fields. The apps in ``positions.examples`` demonstrate the ``PositionField`` API. Indices ~~~~~~~ In general, the value assigned to a ``PositionField`` will be handled like a list index, to include negative values. Setting the position to ``-2`` will cause the item to be moved to the second position from the end of collection -- unless, of course, the collection has fewer than two elements. Behavior varies from standard list indices when values greater than or less than the maximum or minimum positions are used. In those cases, the value is handled as being the same as the maximum or minimum position, respectively. ``None`` is also a special case that will cause an item to be moved to the last position in its collection. Limitations ----------- * Unique constraints can't be applied to ``PositionField`` because they break the ability to update other items in a collection all at once. This one was a bit painful, because setting the constraint is probably the right thing to do from a database consistency perspective, but the overhead in additional queries was too much to bear. * After a position has been updated, other members of the collection are updated using a single SQL ``UPDATE`` statement, this means the ``save`` method of the other instances won't be called. .. _`Django`: http://www.djangoproject.com/







