Merged develop and fixed merge conflict.
commit
1e6a2b1f07
|
|
@ -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,
|
||||||
|
|
@ -35,7 +35,7 @@ django-admin-sortable 1.7.1 and higher are compatible with Python 3.
|
||||||
Download django-admin-sortable from [source](https://github.com/iambrandontaylor/django-admin-sortable/archive/master.zip)
|
Download django-admin-sortable from [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 PYTHONPATH.
|
3. Run `$ python setup.py install` or add `adminsortable` to your PYTHONPATH.
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -460,9 +460,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,
|
||||||
|
|
@ -50,7 +50,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.
|
||||||
|
|
||||||
|
|
@ -604,12 +607,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,4 @@
|
||||||
VERSION = (2, 0, 9) # following PEP 386
|
VERSION = (2, 0, 10)
|
||||||
DEV_N = None
|
DEV_N = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ from django.template.defaultfilters import capfirst
|
||||||
|
|
||||||
from adminsortable.fields import SortableForeignKey
|
from adminsortable.fields import SortableForeignKey
|
||||||
from adminsortable.models import SortableMixin
|
from adminsortable.models import SortableMixin
|
||||||
from adminsortable.utils import get_is_sortable, check_model_is_sortable
|
from adminsortable.utils import get_is_sortable
|
||||||
|
|
||||||
STATIC_URL = settings.STATIC_URL
|
STATIC_URL = settings.STATIC_URL
|
||||||
|
|
||||||
|
|
@ -188,7 +188,16 @@ 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 (AttributeError, IndexError):
|
||||||
|
# for Django 1.5.x
|
||||||
|
order_field_name = opts.ordering[0]
|
||||||
|
finally:
|
||||||
|
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