Merge pull request #245 from sh-cho/patch-1

Update REAMDME
master
Brandon Taylor 2021-07-27 08:25:36 -04:00 committed by GitHub
commit c0874bfd7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -85,14 +85,14 @@ Inlines may be drag-and-dropped into any order directly from the change form.
To add "sortability" to a model, you need to inherit `SortableMixin` and at minimum, define:
- The field which should be used for `Meta.ordering`, which must resolve to one of the integer fields defined in Django's ORM:
- `PositiveIntegerField`
- `IntegerField`
- `PositiveSmallIntegerField`
- `SmallIntegerField`
- `BigIntegerField`
- `PositiveIntegerField`
- `IntegerField`
- `PositiveSmallIntegerField`
- `SmallIntegerField`
- `BigIntegerField`
- `Meta.ordering` **must only contain one value**, otherwise, your objects will not be sorted correctly.
- **IMPORTANT**: You must name the field you use for ordering something other than "order_field" as this name is reserved by the `SortableMixin` class.
- ⚠️ `Meta.ordering` **must only contain one value**, otherwise, your objects will not be sorted correctly.
- ⚠️ **IMPORTANT**: You must name the field you use for ordering something other than "order_field" as this name is reserved by the `SortableMixin` class.
- It is recommended that you set `editable=False` and `db_index=True` on the field defined in `Meta.ordering` for a seamless Django admin experience and faster lookups on the objects.
Sample Model:
@ -442,7 +442,7 @@ It is also possible to sort a subset of objects in your model by adding a `sorti
#### Self-Referential SortableForeignKey
You can specify a self-referential SortableForeignKey field, however the admin interface will currently show a model that is a grandchild at the same level as a child. I'm working to resolve this issue.
##### Important!
##### ⚠️ Important!
django-admin-sortable 1.6.6 introduced a backwards-incompatible change for `sorting_filters`. Previously this attribute was defined as a dictionary, so you'll need to change your values over to the new tuple-based format.
An example of sorting subsets would be a "Board of Directors". In this use case, you have a list of "People" objects. Some of these people are on the Board of Directors and some not, and you need to sort them independently.