Skip to content
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
2 changes: 1 addition & 1 deletion .checkignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
tests/*
django_fsm/tests/*
django_fsm/tests/*
38 changes: 38 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
default_language_version:
python: python3.8
python_venv: python3.8 # Optional

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
args: ["--maxkb=700"]
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace

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

- repo: https://github.com/adamchainz/django-upgrade
rev: 1.15.0
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]

# - repo: https://github.com/astral-sh/ruff-pre-commit
# rev: v0.0.291
# hooks:
# - id: ruff-format
# - id: ruff
3 changes: 1 addition & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
persistent=yes

[MESSAGES CONTROL]
# C0111 = Missing docstring
# C0111 = Missing docstring
# I0011 = # Warning locally suppressed using disable-msg
# I0012 = # Warning locally suppressed using disable-msg
disable=I0011,I0012
Expand Down Expand Up @@ -60,4 +60,3 @@ max-parents=7
max-attributes=7
min-public-methods=0
max-public-methods=20

4 changes: 3 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
copyright (c) 2010 Mikhail Podgurskiy
The MIT License (MIT)

Copyright (c) 2010 Mikhail Podgurskiy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ on a model instance with a protected FSMField will cause an exception.

``source`` parameter accepts a list of states, or an individual state or ``django_fsm.State`` implementation.

You can use ``*`` for ``source`` to allow switching to ``target`` from any state.
You can use ``*`` for ``source`` to allow switching to ``target`` from any state.

You can use ``+`` for ``source`` to allow switching to ``target`` from any state excluding ``target`` state.

Expand All @@ -163,7 +163,7 @@ You can use ``+`` for ``source`` to allow switching to ``target`` from any state
``target`` state parameter could point to a specific state or ``django_fsm.State`` implementation

.. code:: python

from django_fsm import FSMField, transition, RETURN_VALUE, GET_STATE
@transition(field=state,
source='*',
Expand Down
4 changes: 2 additions & 2 deletions django_fsm/management/commands/graph_transitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from django.core.management.base import BaseCommand
try:
from django.utils.encoding import force_text
from django.utils.encoding import force_str
_requires_system_checks = True
except ImportError: # Django >= 4.0
from django.utils.encoding import force_str as force_text
Expand Down Expand Up @@ -41,7 +41,7 @@ def node_name(field, state):

def node_label(field, state):
if type(state) == int or (type(state) == bool and hasattr(field, "choices")):
return force_text(dict(field.choices).get(state))
return force_str(dict(field.choices).get(state))
else:
return state

Expand Down
23 changes: 5 additions & 18 deletions tests/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import django

PROJECT_APPS = (
"django_fsm",
"testapp",
Expand All @@ -25,22 +23,11 @@
}
}

if django.VERSION < (1, 9):

class DisableMigrations:
def __contains__(self, item):
return True

def __getitem__(self, item):
return "notmigrations"

MIGRATION_MODULES = DisableMigrations()
else:
MIGRATION_MODULES = {
"auth": None,
"contenttypes": None,
"guardian": None,
}
MIGRATION_MODULES = {
"auth": None,
"contenttypes": None,
"guardian": None,
}


ANONYMOUS_USER_ID = 0
Expand Down