Skip to content

Commit

Permalink
Merge pull request #72 from pinax/django4_support
Browse files Browse the repository at this point in the history
Django 4 compatibility
  • Loading branch information
uhurusurfa authored Apr 16, 2023
2 parents 6a1a3dd + 0903781 commit 054b2dd
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 51 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Django CI

on: [pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.8, 3.9, "3.10" ]
django-version: [3.2, 4.2 ]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "django ==${{ matrix.django-version }}"
make init
- name: Run Tests
run: |
make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ __pycache__/

# Distribution / packaging
.Python
.venv
env/
build/
develop-eggs/
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ all: init test

init:
python setup.py develop
pip install tox "coverage<5"
pip install tox coverage

test:
coverage erase
tox --parallel--safe-build
tox
coverage html
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,10 @@ Iterable excludes teams user is already associated with.

## Change Log

### 2.1.0
### 3.0.0

* Drop Django 2 and <3.2 and Python 2.*, <3.6 support
* Add Django 4.0, and Python 3.7, 3.8 and 3.9 support
* Update packaging configs
* Direct users to community resources


### 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion pinax/teams/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from reversion.admin import VersionAdmin

Expand Down
3 changes: 2 additions & 1 deletion pinax/teams/apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import importlib

from django.apps import AppConfig as BaseAppConfig
from django.utils.translation import gettext_lazy as _
import importlib


class AppConfig(BaseAppConfig):
Expand Down
2 changes: 1 addition & 1 deletion pinax/teams/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import forms
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from account.forms import SignupForm

Expand Down
2 changes: 1 addition & 1 deletion pinax/teams/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from pinax.invitations.models import JoinInvitation
from reversion import revisions as reversion
Expand Down
16 changes: 8 additions & 8 deletions pinax/teams/signals.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import django.dispatch

added_member = django.dispatch.Signal(providing_args=["membership", "by"])
invited_user = django.dispatch.Signal(providing_args=["membership", "by"])
promoted_member = django.dispatch.Signal(providing_args=["membership", "by"])
demoted_member = django.dispatch.Signal(providing_args=["membership", "by"])
accepted_membership = django.dispatch.Signal(providing_args=["membership"])
rejected_membership = django.dispatch.Signal(providing_args=["membership"])
resent_invite = django.dispatch.Signal(providing_args=["membership", "by"])
removed_membership = django.dispatch.Signal(providing_args=["team", "user", "invitee", "by"])
added_member = django.dispatch.Signal()
invited_user = django.dispatch.Signal()
promoted_member = django.dispatch.Signal()
demoted_member = django.dispatch.Signal()
accepted_membership = django.dispatch.Signal()
rejected_membership = django.dispatch.Signal()
resent_invite = django.dispatch.Signal()
removed_membership = django.dispatch.Signal()
6 changes: 3 additions & 3 deletions pinax/teams/tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.conf.urls import include, url
from django.urls import include, re_path

urlpatterns = [
url(r"^account/", include("account.urls")),
url(r"^", include("pinax.teams.urls", namespace="pinax_teams")),
re_path(r"^account/", include("account.urls")),
re_path(r"^", include("pinax.teams.urls", namespace="pinax_teams")),
]
36 changes: 18 additions & 18 deletions pinax/teams/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import url
from django.urls import re_path

from . import views

Expand All @@ -7,26 +7,26 @@

urlpatterns = [
# overall
url(r"^$", views.TeamListView.as_view(), name="team_list"),
url(r"^:create/$", views.TeamCreateView.as_view(), name="team_create"),
re_path(r"^$", views.TeamListView.as_view(), name="team_list"),
re_path(r"^:create/$", views.TeamCreateView.as_view(), name="team_create"),

# team specific
url(r"^(?P<slug>[\w\-]+)/$", views.team_detail, name="team_detail"),
url(r"^(?P<slug>[\w\-]+)/join/$", views.team_join, name="team_join"),
url(r"^(?P<slug>[\w\-]+)/leave/$", views.team_leave, name="team_leave"),
url(r"^(?P<slug>[\w\-]+)/apply/$", views.team_apply, name="team_apply"),
url(r"^(?P<slug>[\w\-]+)/edit/$", views.team_update, name="team_edit"),
url(r"^(?P<slug>[\w\-]+)/manage/$", views.TeamManageView.as_view(), name="team_manage"),
re_path(r"^(?P<slug>[\w\-]+)/$", views.team_detail, name="team_detail"),
re_path(r"^(?P<slug>[\w\-]+)/join/$", views.team_join, name="team_join"),
re_path(r"^(?P<slug>[\w\-]+)/leave/$", views.team_leave, name="team_leave"),
re_path(r"^(?P<slug>[\w\-]+)/apply/$", views.team_apply, name="team_apply"),
re_path(r"^(?P<slug>[\w\-]+)/edit/$", views.team_update, name="team_edit"),
re_path(r"^(?P<slug>[\w\-]+)/manage/$", views.TeamManageView.as_view(), name="team_manage"),

# membership specific
url(r"^(?P<slug>[\w\-]+)/ac/users-to-invite/$", views.autocomplete_users, name="team_autocomplete_users"), # noqa
url(r"^(?P<slug>[\w\-]+)/invite-user/$", views.TeamInviteView.as_view(), name="team_invite"),
url(r"^(?P<slug>[\w\-]+)/members/(?P<pk>\d+)/revoke-invite/$", views.team_member_revoke_invite, name="team_member_revoke_invite"), # noqa
url(r"^(?P<slug>[\w\-]+)/members/(?P<pk>\d+)/resend-invite/$", views.team_member_resend_invite, name="team_member_resend_invite"), # noqa
url(r"^(?P<slug>[\w\-]+)/members/(?P<pk>\d+)/promote/$", views.team_member_promote, name="team_member_promote"), # noqa
url(r"^(?P<slug>[\w\-]+)/members/(?P<pk>\d+)/demote/$", views.team_member_demote, name="team_member_demote"), # noqa
url(r"^(?P<slug>[\w\-]+)/members/(?P<pk>\d+)/remove/$", views.team_member_remove, name="team_member_remove"), # noqa
re_path(r"^(?P<slug>[\w\-]+)/ac/users-to-invite/$", views.autocomplete_users, name="team_autocomplete_users"), # noqa
re_path(r"^(?P<slug>[\w\-]+)/invite-user/$", views.TeamInviteView.as_view(), name="team_invite"),
re_path(r"^(?P<slug>[\w\-]+)/members/(?P<pk>\d+)/revoke-invite/$", views.team_member_revoke_invite, name="team_member_revoke_invite"), # noqa
re_path(r"^(?P<slug>[\w\-]+)/members/(?P<pk>\d+)/resend-invite/$", views.team_member_resend_invite, name="team_member_resend_invite"), # noqa
re_path(r"^(?P<slug>[\w\-]+)/members/(?P<pk>\d+)/promote/$", views.team_member_promote, name="team_member_promote"), # noqa
re_path(r"^(?P<slug>[\w\-]+)/members/(?P<pk>\d+)/demote/$", views.team_member_demote, name="team_member_demote"), # noqa
re_path(r"^(?P<slug>[\w\-]+)/members/(?P<pk>\d+)/remove/$", views.team_member_remove, name="team_member_remove"), # noqa

url(r"^accept/(?P<pk>\d+)/$", views.team_accept, name="team_accept"),
url(r"^reject/(?P<pk>\d+)/$", views.team_reject, name="team_reject"),
re_path(r"^accept/(?P<pk>\d+)/$", views.team_accept, name="team_accept"),
re_path(r"^reject/(?P<pk>\d+)/$", views.team_reject, name="team_reject"),
]
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import find_packages, setup

VERSION = "2.1.0"
VERSION = "3.0.0"
LONG_DESCRIPTION = r"""
.. image:: http://pinaxproject.com/pinax-design/patches/pinax-teams.svg
:target: https://pypi.python.org/pypi/pinax-teams/
Expand Down Expand Up @@ -80,14 +80,14 @@
install_requires=[
"django>=3.2",
"django-reversion>=5.0.4",
"pinax-invitations>=7.0.0",
"pinax-invitations>=8.0.0",
"python-slugify>=7.0.0",
"Pillow>=9.3.0",
"django-user-accounts>=3.2.0"
],
tests_require=[
"django-test-plus>=1.0.22",
"pinax-templates>=1.0.4",
"pinax-templates>=3.0.0",
],
test_suite="runtests.runtests",
zip_safe=False
Expand Down
18 changes: 8 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ show_missing = True
[tox]
envlist =
checkqa,
py{37,38,39,310}-dj{32,41}
dj

[testenv]
passenv = CI CIRCLECI CIRCLE_*
passenv = CI,CIRCLECI,CIRCLE_*
deps =
coverage<5
codecov
dj22: Django>=3.2,<4.0
dj41: Django>=4.0,<5.0
coverage
dj: Django>=3.2,<5.0
master: https://github.com/django/django/tarball/master

usedevelop = True
Expand All @@ -47,8 +45,8 @@ commands =
[testenv:checkqa]
commands =
flake8 pinax
isort --recursive --check-only --diff pinax -sp tox.ini
isort --check-only --diff pinax --settings-path tox.ini
deps =
flake8 == 6.0.0
flake8-quotes == 3.3.2
isort == 5.12.0
flake8
flake8-quotes
isort

0 comments on commit 054b2dd

Please sign in to comment.