Compare commits

..

No commits in common. "master" and "v2.2.4" have entirely different histories.

7 changed files with 41 additions and 73 deletions

View file

@ -1,52 +0,0 @@
---
name: Tests
on:
push:
branches:
- develop
- master
pull_request:
jobs:
tests:
name: Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
django-version:
- "2.2.17" # first version to support Python 3.9
- "3.1.3" # first version to support Python 3.9
- "3.2.0"
include:
- python-version: "3.8"
django-version: "4.0.0"
- python-version: "3.9"
django-version: "4.0.0"
- python-version: "3.10"
django-version: "3.2.9" # first version to support Python 3.10
- python-version: "3.10"
django-version: "4.0.0"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install --upgrade "django~=${{ matrix.django-version}}"
- name: Run tests
run: python manage.py test
working-directory: sample_project

24
.travis.yml Normal file
View file

@ -0,0 +1,24 @@
arch:
- amd64
- ppc64le
language: python
python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
env:
- DJANGO_VERSION=2.2 SAMPLE_PROJECT=sample_project
- DJANGO_VERSION=3.1 SAMPLE_PROJECT=sample_project
- DJANGO_VERSION=3.2 SAMPLE_PROJECT=sample_project
branches:
only:
- develop
install:
- pip install django==$DJANGO_VERSION
script:
- cd $SAMPLE_PROJECT
- python manage.py test

View file

@ -22,9 +22,7 @@ Sorting inlines:
![sortable-inlines](http://res.cloudinary.com/alsoicode/image/upload/v1451237555/django-admin-sortable/sortable-inlines.jpg) ![sortable-inlines](http://res.cloudinary.com/alsoicode/image/upload/v1451237555/django-admin-sortable/sortable-inlines.jpg)
## Supported Django Versions ## Supported Django Versions
For Django 4 use the latest version For Django 3 use the latest version
For Django 3 use 2.2.4
For Django 1.8.x < 3.0, use 2.1.8. For Django 1.8.x < 3.0, use 2.1.8.
@ -87,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: 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: - The field which should be used for `Meta.ordering`, which must resolve to one of the integer fields defined in Django's ORM:
- `PositiveIntegerField` - `PositiveIntegerField`
- `IntegerField` - `IntegerField`
- `PositiveSmallIntegerField` - `PositiveSmallIntegerField`
- `SmallIntegerField` - `SmallIntegerField`
- `BigIntegerField` - `BigIntegerField`
- ⚠️ `Meta.ordering` **must only contain one value**, otherwise, your objects will not be sorted correctly. - `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. - **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. - 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: Sample Model:
@ -444,7 +442,7 @@ It is also possible to sort a subset of objects in your model by adding a `sorti
#### Self-Referential SortableForeignKey #### 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. 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. 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. 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.
@ -670,8 +668,8 @@ ordering on top of that just seemed a little much in my opinion.
### Status ### Status
django-admin-sortable is currently used in production. django-admin-sortable is currently used in production.
### What's new in 2.3.0? ### What's new in 2.2.3?
- Django 4 compatibility - Updated inline sortable templates to fix FontAwesome icon visibility and be compatible with Django 2 & 3.
### Future ### Future
- Better template support for foreign keys that are self referential. If someone would like to take on rendering recursive sortables, that would be super. - Better template support for foreign keys that are self referential. If someone would like to take on rendering recursive sortables, that would be super.

View file

@ -27,9 +27,7 @@ Sorting inlines:
Supported Django Versions Supported Django Versions
------------------------- -------------------------
For Django 4 use the latest version For Django 3 use the latest version
For Django 3 use 2.2.4
For Django 1.8.x < 3.0, use 2.1.8. For Django 1.8.x < 3.0, use 2.1.8.
@ -753,10 +751,10 @@ Status
django-admin-sortable is currently used in production. django-admin-sortable is currently used in production.
Whats new in 2.3.0? Whats new in 2.2.3?
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
- Django 4 compatibility - Updated inline sortable templates to fix FontAwesome icon visibility and be compatible with Django 2 & 3.
Future Future
~~~~~~ ~~~~~~

View file

@ -1,4 +1,4 @@
VERSION = (2, 3, 0) VERSION = (2, 2, 4)
DEV_N = None DEV_N = None

View file

@ -2,6 +2,7 @@ import json
from urllib.parse import urlencode from urllib.parse import urlencode
from django.conf import settings from django.conf import settings
from django.conf.urls import re_path
from django.contrib.admin import ModelAdmin, TabularInline, StackedInline from django.contrib.admin import ModelAdmin, TabularInline, StackedInline
from django.contrib.admin.options import InlineModelAdmin from django.contrib.admin.options import InlineModelAdmin
from django.contrib.admin.views.main import IGNORED_PARAMS, PAGE_VAR from django.contrib.admin.views.main import IGNORED_PARAMS, PAGE_VAR
@ -13,7 +14,6 @@ from django.db import transaction
from django.http import JsonResponse from django.http import JsonResponse
from django.shortcuts import render from django.shortcuts import render
from django.template.defaultfilters import capfirst from django.template.defaultfilters import capfirst
from django.urls import re_path
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from django.views.decorators.http import require_POST from django.views.decorators.http import require_POST

View file

@ -1,6 +1,6 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
with open('README.rst', encoding='utf8') as readme_file: with open('README.rst') as readme_file:
README = readme_file.read() README = readme_file.read()
setup( setup(