Fixed access of custom order property in model meta, falling back to order for legacy implementations.
Updated readme and version bump to 2.0.10master
parent
b8a5238a09
commit
66c73a6bdc
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[](https://travis-ci.org/iambrandontaylor/django-admin-sortable)
|
[](https://travis-ci.org/iambrandontaylor/django-admin-sortable)
|
||||||
|
|
||||||
Current version: 2.0.9
|
Current version: 2.0.10
|
||||||
|
|
||||||
This project makes it easy to add drag-and-drop ordering to any model in
|
This project makes it easy to add drag-and-drop ordering to any model in
|
||||||
Django admin. Inlines for a sortable model may also be made sortable,
|
Django admin. Inlines for a sortable model may also be made sortable,
|
||||||
|
|
@ -457,9 +457,8 @@ ordering on top of that just seemed a little much in my opinion.
|
||||||
django-admin-sortable is currently used in production.
|
django-admin-sortable is currently used in production.
|
||||||
|
|
||||||
|
|
||||||
### What's new in 2.0.9?
|
### What's new in 2.0.10?
|
||||||
- Added icons for sortable elements
|
- Bugfix for accessing custom `order` property of model. Thanks [@theithec](https://github.com/theithec) for reporting the issue.
|
||||||
- Refactored determination of sortability of fields that are instances of `SortableForeignKey` in admin
|
|
||||||
|
|
||||||
|
|
||||||
### Future
|
### Future
|
||||||
|
|
|
||||||
16
README.rst
16
README.rst
|
|
@ -3,7 +3,7 @@ Django Admin Sortable
|
||||||
|
|
||||||
|Build Status|
|
|Build Status|
|
||||||
|
|
||||||
Current version: 2.0.9
|
Current version: 2.0.10
|
||||||
|
|
||||||
This project makes it easy to add drag-and-drop ordering to any model in
|
This project makes it easy to add drag-and-drop ordering to any model in
|
||||||
Django admin. Inlines for a sortable model may also be made sortable,
|
Django admin. Inlines for a sortable model may also be made sortable,
|
||||||
|
|
@ -36,7 +36,10 @@ Download django-admin-sortable from
|
||||||
`source <https://github.com/iambrandontaylor/django-admin-sortable/archive/master.zip>`__
|
`source <https://github.com/iambrandontaylor/django-admin-sortable/archive/master.zip>`__
|
||||||
|
|
||||||
1. Unzip the directory and cd into the uncompressed project directory
|
1. Unzip the directory and cd into the uncompressed project directory
|
||||||
2. \*Optional: Enable your virtualenv
|
2.
|
||||||
|
|
||||||
|
- Optional: Enable your virtualenv
|
||||||
|
|
||||||
3. Run ``$ python setup.py install`` or add ``adminsortable`` to your
|
3. Run ``$ python setup.py install`` or add ``adminsortable`` to your
|
||||||
PYTHONPATH.
|
PYTHONPATH.
|
||||||
|
|
||||||
|
|
@ -593,12 +596,11 @@ Status
|
||||||
|
|
||||||
django-admin-sortable is currently used in production.
|
django-admin-sortable is currently used in production.
|
||||||
|
|
||||||
What's new in 2.0.9?
|
What's new in 2.0.10?
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
- Added icons for sortable elements
|
- Bugfix for accessing custom ``order`` property of model. Thanks
|
||||||
- Refactored determination of sortability of fields that are instances
|
[@theithec](https://github.com/theithec) for reporting the issue.
|
||||||
of ``SortableForeignKey`` in admin
|
|
||||||
|
|
||||||
Future
|
Future
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
|
<<<<<<< Updated upstream
|
||||||
VERSION = (2, 0, 8) # following PEP 386
|
VERSION = (2, 0, 8) # following PEP 386
|
||||||
|
=======
|
||||||
|
VERSION = (2, 0, 10) # following PEP 386
|
||||||
|
>>>>>>> Stashed changes
|
||||||
DEV_N = None
|
DEV_N = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,13 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
|
||||||
# Order the objects by the property they are sortable by,
|
# Order the objects by the property they are sortable by,
|
||||||
# then by the order, otherwise the regroup
|
# then by the order, otherwise the regroup
|
||||||
# template tag will not show the objects correctly
|
# template tag will not show the objects correctly
|
||||||
objects = objects.order_by(sortable_by_expression, 'order')
|
|
||||||
|
try:
|
||||||
|
order_field_name = opts.model._meta.ordering[0]
|
||||||
|
except IndexError:
|
||||||
|
order_field_name = 'order'
|
||||||
|
|
||||||
|
objects = objects.order_by(sortable_by_expression, order_field_name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
verbose_name_plural = opts.verbose_name_plural.__unicode__()
|
verbose_name_plural = opts.verbose_name_plural.__unicode__()
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue