Skip to content
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

Sync with upstream #4

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Check

on:
- push
- pull_request

jobs:
build:
name: ${{ matrix.tox-environment }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
tox-environment:
- docs
- lint

env:
TOXENV: ${{ matrix.tox-environment }}

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2

- name: Set up system dependencies
run: |
sudo apt-get update
sudo apt-get install gettext

- name: Install dependencies
run: python -m pip install tox

- name: Run
run: tox
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test

on:
- push
- pull_request

jobs:
build:
name: Python ${{ matrix.python-version }} / ${{ matrix.tox-environment }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version:
- 3.6
- 3.7
- 3.8
- 3.9
- pypy3
tox-environment:
# Previous LTS
- django22
# Latest release
- django32

env:
TOXENV: ${{ matrix.tox-environment }}

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Set up system dependencies
run: |
sudo apt-get update
sudo apt-get install gettext

- name: Install dependencies
run: python -m pip install tox

- name: Run tests
run: tox
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2011-2013, Raphaël Barrois
Copyright (c) 2011-2020, Raphaël Barrois
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
11 changes: 6 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
include CREDITS ChangeLog LICENSE README.rst
include requirements*.txt
# Required for 'setup.py build'
include Makefile

graft django_xworkflows

prune dev
prune docs
prune tests
graft dev
graft docs
graft tests

prune docs/_build

global-exclude *.py[cod] __pycache__

exclude tox.ini .flake8 manage.py
include tox.ini .flake8 manage.py
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ DOC_DIR=docs
# Use current python binary instead of system default.
COVERAGE = python $(shell which coverage)
FLAKE8 = flake8
MANAGE_PY = python manage.py
DJANGO_ADMIN = django-admin.py
PO_FILES = $(shell find $(PACKAGE) -name '*.po')
MO_FILES = $(PO_FILES:.po=.mo)
Expand Down Expand Up @@ -36,17 +35,17 @@ build: $(MO_FILES)
cd $(abspath $(dir $<)/../../..) && $(DJANGO_ADMIN) compilemessages

# DOC: Install and/or upgrade dependencies
update:
setup-dev:
pip install --upgrade pip setuptools
pip install --upgrade -r requirements_dev.txt
pip install --upgrade -e .[dev,doc]
pip freeze


release:
fullrelease


.PHONY: all default clean build update release
.PHONY: all default clean build setup-dev release


# Tests and quality
Expand All @@ -59,16 +58,16 @@ testall:

# DOC: Run tests for the currently installed version
test: build
PYTHONPATH=. python -Wdefault $(TESTS_DIR)/runner.py
python -Werror ./manage.py test tests.djworkflows.tests



# Note: we run the linter in two runs, because our __init__.py files has specific warnings we want to exclude
# DOC: Perform code quality tasks
lint:
$(FLAKE8) --config .flake8 --exclude $(PACKAGE)/__init__.py $(PACKAGE)
$(FLAKE8) --config .flake8 --ignore F401 $(PACKAGE)/__init__.py
$(FLAKE8) --config .flake8 $(TESTS_DIR)
$(FLAKE8) --exclude $(PACKAGE)/__init__.py $(PACKAGE)
$(FLAKE8) --ignore F401 $(PACKAGE)/__init__.py
$(FLAKE8) $(TESTS_DIR)
check-manifest

coverage:
Expand Down
8 changes: 6 additions & 2 deletions dev/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
}
}

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
Expand Down Expand Up @@ -104,20 +106,22 @@
},
]

MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'migration_helper.urls'
ROOT_URLCONF = 'dev.urls'

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
'tests.djworkflows',
'django_xworkflows',
'django_xworkflows.xworkflow_log',
)

Expand Down
13 changes: 1 addition & 12 deletions dev/urls.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
from django.conf.urls.defaults import patterns, include, url

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
# Examples:
# url(r'^$', 'migration_helper.views.home', name='home'),
# url(r'^migration_helper/', include('migration_helper.foo.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
# url(r'^admin/', include(admin.site.urls)),
)
urlpatterns = []
4 changes: 2 additions & 2 deletions django_xworkflows/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2013 Raphaël Barrois
# Copyright (c) 2011-2020 Raphaël Barrois
# This code is distributed under the two-clause BSD license.

__version__ = '0.12.4.dev0'
__version__ = '1.0.1.dev0'
__author__ = 'Raphaël Barrois <[email protected]>'
12 changes: 0 additions & 12 deletions django_xworkflows/compat.py

This file was deleted.

2 changes: 1 addition & 1 deletion django_xworkflows/locale/fr_FR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Locale for django-xworkflows.
# Copyright (C) 2011 Raphaël Barrois
# Copyright (C) 2011-2020 Raphaël Barrois
# This file is distributed under the same license as the django-xworkflows package.
# Raphaël Barrois <[email protected]> 2011.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2013 Raphaël Barrois
# Copyright (c) 2011-2020 Raphaël Barrois
# This code is distributed under the two-clause BSD license.

from __future__ import unicode_literals


"""Rebuild missing from_state/to_state fields on TransitionLog objects."""

Expand Down
12 changes: 3 additions & 9 deletions django_xworkflows/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2013 Raphaël Barrois
# Copyright (c) 2011-2020 Raphaël Barrois
# This code is distributed under the two-clause BSD license.

from __future__ import unicode_literals

"""Specific versions of XWorkflows to use with Django."""

from django.apps import apps
Expand All @@ -16,9 +14,8 @@
from django.forms import fields
from django.forms import widgets
from django.utils.deconstruct import deconstructible
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from xworkflows import base

Expand Down Expand Up @@ -249,7 +246,7 @@ class BaseWorkflowEnabled(base.BaseWorkflowEnabled):
def _get_FIELD_display(self, field):
if isinstance(field, StateField):
value = getattr(self, field.attname)
return force_text(value.title)
return str(value.title)
else:
return super(BaseWorkflowEnabled, self)._get_FIELD_display(field)

Expand Down Expand Up @@ -292,9 +289,7 @@ def get_default_log_model():

class DjangoImplementationWrapper(base.ImplementationWrapper):
"""Restrict execution of transitions within templates"""
# django < 1.4
alters_data = True
# django >= 1.4
do_not_call_in_templates = True


Expand Down Expand Up @@ -423,7 +418,6 @@ def log_transition(self, transition, from_state, instance, *args, **kwargs):
self.db_log(transition, from_state, instance, *args, **kwargs)


@python_2_unicode_compatible
class BaseTransitionLog(models.Model):
"""Abstract model for a minimal database logging setup.

Expand Down
4 changes: 1 addition & 3 deletions django_xworkflows/xworkflow_log/admin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2013 Raphaël Barrois
# Copyright (c) 2011-2020 Raphaël Barrois
# This code is distributed under the two-clause BSD license.

from __future__ import unicode_literals

from . import models

from django.contrib import admin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Locale for django-xworkflows.
# Copyright (C) 2011 Raphaël Barrois
# Copyright (C) 2011-2020 Raphaël Barrois
# This file is distributed under the same license as the django-xworkflows package.
# Raphaël Barrois <[email protected]> 2011.
#
Expand Down
3 changes: 1 addition & 2 deletions django_xworkflows/xworkflow_log/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# flake8: noqa
from __future__ import unicode_literals

from django.db import models, migrations
import django.utils.timezone
Expand All @@ -12,7 +11,7 @@
class Migration(migrations.Migration):

dependencies = [
('contenttypes', '0001_initial'),
('contenttypes', '0002_remove_content_type_name'),
migrations.swappable_dependency(XWORKFLOWS_USER_MODEL),
]

Expand Down
6 changes: 2 additions & 4 deletions django_xworkflows/xworkflow_log/models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2013 Raphaël Barrois
# Copyright (c) 2011-2020 Raphaël Barrois
# This code is distributed under the two-clause BSD license.

from __future__ import unicode_literals

from django.conf import settings
from django.db import models as django_models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from .. import models

Expand Down
Loading
Loading