Skip to content

Update Django and Python support #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
cache: poetry

- name: Install requirements
Expand All @@ -34,3 +34,5 @@ jobs:

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- uses: pre-commit/[email protected]
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
default_language_version:
python: python3.11
python: python3.12

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ["--maxkb=700"]
Expand All @@ -18,14 +18,14 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
rev: v3.20.0
hooks:
- id: pyupgrade
args:
- "--py38-plus"

- repo: https://github.com/adamchainz/django-upgrade
rev: 1.18.0
rev: 1.25.0
hooks:
- id: django-upgrade
args: [--target-version, "4.2"]
Expand All @@ -44,7 +44,7 @@ repos:
- id: poetry-export

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.8
rev: v0.11.12
hooks:
- id: ruff-format
- id: ruff
- id: ruff-check
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
django-fsm adds simple declarative state management for django models.

> [!IMPORTANT]
> Django FSM-2 started as a fork of [Django FSM](https://github.com/viewflow/django-fsm).
> Django FSM-2 is a maintained fork of [Django FSM](https://github.com/viewflow/django-fsm).
>
> Big thanks to Mikhail Podgurskiy for starting this awesome project and maintaining it for so many years.
>
> Unfortunately, development has stalled for almost 2 years and it was officially announced there will be no new releases. [Viewflow](https://github.com/viewflow/viewflow) is presented as an alternative but the transition is not that easy.
> Unfortunately, after 2 years without any releases, the project was brutally archived. [Viewflow](https://github.com/viewflow/viewflow) is presented as an alternative but the transition is not that easy.
>
> If what you need is just a simple state machine, tailor-made for Django, Django FSM-2 is the successor of Django FSM, with dependencies updates, typing (planned)

Expand All @@ -39,6 +39,16 @@ Or, for the latest git version
$ pip install -e git://github.com/django-commons/django-fsm-2.git#egg=django-fsm
```

## Migration from django-fsm

django-fsm-2 is a drop-in replacement, it's actually the same project but from a different source.
So all you need to do is to replace `django-fsm` dependency with `django-fsm-2`. And voila!

``` bash
$ pip install django-fsm-2
```


## Usage

Add FSMState field to your model
Expand Down
2 changes: 1 addition & 1 deletion django_fsm/management/commands/graph_transitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def add_arguments(self, parser):
"-o",
action="store",
dest="outputfile",
help=("Render output file. Type of output dependent on file extensions. " "Use png or jpg to render graph to image."),
help=("Render output file. Type of output dependent on file extensions. Use png or jpg to render graph to image."),
)
parser.add_argument(
"--layout",
Expand Down
4 changes: 0 additions & 4 deletions django_fsm/tests/test_protected_fields.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from __future__ import annotations

import unittest

import django
from django.db import models
from django.test import TestCase

Expand Down Expand Up @@ -40,7 +37,6 @@ def try_change():
instance.save()
self.assertEqual(instance.status, "published")

@unittest.skipIf(django.VERSION < (1, 8), "Django introduced refresh_from_db in 1.8")
def test_refresh_from_db(self):
instance = RefreshableModel()
instance.save()
Expand Down
43 changes: 38 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading