Incremented version to 1.2.

Refactored ORM calls to properly order objects by the sortable_by property to ensure objects are grouped correctly in the sortable change list template after being passed through dynamic_regroup.
Fixed missing import for jquery.effects.core, again.
Refactored sortable_by classmethod into a property.
This commit is contained in:
Brandon Taylor
2011-11-22 22:19:39 -06:00
parent 1b9c5c0a64
commit 63a80f5953
10 changed files with 132 additions and 127 deletions
+14 -6
View File
@@ -46,8 +46,9 @@ have an inner Meta class that inherits from ``Sortable.Meta``
For models that you want sortable relative to a ``ForeignKey`` field, you need to
specify an ``@classmethod`` that returns a double: the foreign key class, and the
name of the foreign key property as defined on your model, as a string.
specify a property: ``sortable_by`` that is equal to the class defined as your ForeignKey field.
If you're upgrading from a version < 1.2, you do not need to redefine sortable_by.
1.2 is backwards compatible to 1.0.
#admin.py
class Category(models.Model):
@@ -63,9 +64,7 @@ name of the foreign key property as defined on your model, as a string.
def __unicode__(self):
return self.title
@classmethod
def sortable_by(cls):
return Category, 'category'
sortable_by = Category
Sortable has one field: `order` and adds a default ordering value set to `order`.
@@ -132,7 +131,16 @@ Status
=============
admin-sortable is currently used in production.
Feautures
What's new in 1.2
=============
- Refactored ``sortable_by`` to be a property rather than a classmethod, which is much less work to implement.
- Fixed an issue with ordering which could result in sortable change list view objects not being grouped properly.
- Refactored the ORM calls to determine if an object is sortable, and what the next order should be, to return
scalar values and to not hydrate any objects whatsoever. This potentially decreases memory usage by exponential
factors.
Features
=============
Current
---------