Compare commits

...

11 commits

Author SHA1 Message Date
Brandon Taylor
b9c1f3e0c4
Merge pull request #252 from gafderks/gafderks-patch-1
Specify UTF8 encoding for readme
2022-03-12 19:03:22 -05:00
Geert Derks
15766e79d8
Specify UTF8 encoding for readme 2022-01-18 00:13:42 +01:00
Brandon Taylor
844b51456f - Version bump to 2.3.0
- Updated readme
2021-12-21 20:37:48 -05:00
Brandon Taylor
b0c25c303c
Merge pull request #250 from michael-k/gh-actions-python3.10-django4.0
Switch from Travis CI to GitHub Actions and run tests against Python 3.10 and Django 4.0
2021-12-16 20:58:56 -05:00
Michael Käufl
c44edfe40a
Run tests against Python 3.10 and Django 4.0 2021-12-16 12:57:57 +01:00
Michael Käufl
3ae816d64d
Switch from Travis CI to GitHub Actions 2021-12-16 12:56:14 +01:00
Brandon Taylor
aaaa92ba37
Merge pull request #248 from mjr/master
Support Django 4.0
2021-12-13 15:44:00 -05:00
Manaia Junior
508e9f35d6
Replace deprecated django.conf.urls with django.urls 2021-12-13 17:30:10 -03:00
Brandon Taylor
c0874bfd7e
Merge pull request #245 from sh-cho/patch-1
Update REAMDME
2021-07-27 08:25:36 -04:00
Seonghyeon Cho
5aeaa27f5b
Add warning emojis 2021-07-26 23:31:24 +09:00
Seonghyeon Cho
f9a896f469
Fix space for nested list in markdown 2021-07-26 23:29:27 +09:00
7 changed files with 73 additions and 41 deletions

52
.github/workflows/tests.yml vendored Normal file
View file

@ -0,0 +1,52 @@
---
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

View file

@ -1,24 +0,0 @@
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,7 +22,9 @@ 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 3 use the latest version For Django 4 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.
@ -85,14 +87,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:
@ -442,7 +444,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.
@ -668,8 +670,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.2.3? ### What's new in 2.3.0?
- Updated inline sortable templates to fix FontAwesome icon visibility and be compatible with Django 2 & 3. - Django 4 compatibility
### 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,7 +27,9 @@ Sorting inlines:
Supported Django Versions Supported Django Versions
------------------------- -------------------------
For Django 3 use the latest version For Django 4 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.
@ -751,10 +753,10 @@ Status
django-admin-sortable is currently used in production. django-admin-sortable is currently used in production.
Whats new in 2.2.3? Whats new in 2.3.0?
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
- Updated inline sortable templates to fix FontAwesome icon visibility and be compatible with Django 2 & 3. - Django 4 compatibility
Future Future
~~~~~~ ~~~~~~

View file

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

View file

@ -2,7 +2,6 @@ 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
@ -14,6 +13,7 @@ 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') as readme_file: with open('README.rst', encoding='utf8') as readme_file:
README = readme_file.read() README = readme_file.read()
setup( setup(