Skip to content

Commit

Permalink
Add Django 4.x support (#172)
Browse files Browse the repository at this point in the history
Also:
*   Drop official support for Django 1.x
  • Loading branch information
apragacz committed Dec 22, 2021
1 parent 10ef78a commit b47cc94
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 44 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ workflows:
- flake8
- mypy
- setup_project
- test-tox:
name: test-tox-py39-django40
py: "39"
django: "40"
requires:
- test
- test-tox:
name: test-tox-py39-django32
py: "39"
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Full documentation for the project is available at [https://django-rest-registra

## Requirements

* Django (1.10+, 2.0+, 3.0+) and Django-REST-Framework (3.3+)
* Django (2.0+, 3.0+, 4.0+) and Django-REST-Framework (3.3+)
* Python 3.4 or higher (no Python 2 support!)

## Features
Expand Down Expand Up @@ -55,7 +55,7 @@ INSTALLED_APPS=(
'rest_registration',
)
```
After that, you can use the urls in your urlconfig, for instance (using new Django 2.x syntax):
After that, you can use the urls in your urlconfig, for instance:

```python
api_urlpatterns = [
Expand All @@ -72,9 +72,7 @@ urlpatterns = [
]
```

In Django 1.x you can use old `url` instead of `path`.

You can configure Django REST Registraton using the `REST_REGISTRATION`
You can configure Django REST Registration using the `REST_REGISTRATION`
setting in your Django settings (similarly to Django REST Framework).

Below is sample, minimal config you can provide in your django settings which will satisfy the system checks:
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ User registration REST API, based on Django-REST-Framework.
Requirements
------------

- Django (1.10+, 2.0+, 3.0+) and Django-REST-Framework (3.3+)
- Django (2.0+, 3.0+, 4.0+) and Django-REST-Framework (3.3+)
- Python 3.4 or higher (no Python 2 support!)


Expand Down
9 changes: 3 additions & 6 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ so the app templates for notification emails can be accessed:
'rest_registration',
)
After that, you can use the urls in your Django urlconfig, for instance
(using new Django 2.x syntax):
After that, you can use the urls in your Django urlconfig, for instance:

.. code:: python
Expand All @@ -39,9 +38,7 @@ After that, you can use the urls in your Django urlconfig, for instance
path('api/v1/', include(api_urlpatterns)),
]
In Django 1.x you can use old ``url`` instead of ``path``.

In this example, the Django REST Registraton API views will be served under
In this example, the Django REST Registration API views will be served under
``https://your-backend-host/api/v1/accounts/``.
Obviously, you can choose different URI path than ``api/v1/accounts/``,
depending on your preferences.
Expand All @@ -50,7 +47,7 @@ depending on your preferences.
Minimal Configuration
---------------------

You can configure Django REST Registraton using the
You can configure Django REST Registration using the
``REST_REGISTRATION`` setting in your Django settings (similarly to
Django REST Framework).

Expand Down
27 changes: 14 additions & 13 deletions rest_registration/api/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 path

from .views import (
change_password,
Expand All @@ -15,21 +15,22 @@

app_name = 'rest_registration'
urlpatterns = [
url('^register/$', register, name='register'),
url('^verify-registration/$', verify_registration,
name='verify-registration'),
path('register/', register, name='register'),
path('verify-registration/', verify_registration, name='verify-registration'),

url('^send-reset-password-link/$', send_reset_password_link,
name='send-reset-password-link'),
url('^reset-password/$', reset_password, name='reset-password'),
path(
'send-reset-password-link/', send_reset_password_link,
name='send-reset-password-link',
),
path('reset-password/', reset_password, name='reset-password'),

url('^login/$', login, name='login'),
url('^logout/$', logout, name='logout'),
path('login/', login, name='login'),
path('logout/', logout, name='logout'),

url('^profile/$', profile, name='profile'),
path('profile/', profile, name='profile'),

url('^change-password/$', change_password, name='change-password'),
path('change-password/', change_password, name='change-password'),

url('^register-email/$', register_email, name='register-email'),
url('^verify-email/$', verify_email, name='verify-email'),
path('register-email/', register_email, name='register-email'),
path('verify-email/', verify_email, name='verify-email'),
]
9 changes: 4 additions & 5 deletions rest_registration/contrib/verification_redirects/urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from django.conf.urls import url
from django.urls import path

from .views import reset_password, verify_email, verify_registration

app_name = 'rest_registration.contrib.verification_redirects'
urlpatterns = [
url('^verify-registration/$', verify_registration,
name='verify-registration'),
url('^verify-email/$', verify_email, name='verify-email'),
url('^reset-password/$', reset_password, name='reset-password'),
path('verify-registration/', verify_registration, name='verify-registration'),
path('verify-email/', verify_email, name='verify-email'),
path('reset-password/', reset_password, name='reset-password'),
]
8 changes: 3 additions & 5 deletions rest_registration/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
from django.dispatch import Signal

# A new user has registered.
user_registered = Signal(providing_args=["user", "request"])
user_registered = Signal()

# A user has activated his or her account.
user_activated = Signal(providing_args=["user", "request"])
user_activated = Signal()

# A user has verified his or her new email.
user_changed_email = Signal(
providing_args=["user", "new_email", "old_email", "request"]
)
user_changed_email = Signal()
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ classifiers =
Development Status :: 4 - Beta
Environment :: Web Environment
Framework :: Django
Framework :: Django :: 1.10
Framework :: Django :: 2.0
Framework :: Django :: 3.0
Framework :: Django :: 4.0
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: POSIX
Expand Down
5 changes: 2 additions & 3 deletions tests/contrib/verification_redirects/default_urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.conf.urls import include, url
from django.urls import include, path

urlpatterns = [
url('accounts/',
include('rest_registration.contrib.verification_redirects.urls')),
path('accounts/', include('rest_registration.contrib.verification_redirects.urls')),
]
6 changes: 3 additions & 3 deletions tests/default_urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from django.conf.urls import include, url
from django.urls import include, path

api_urlpatterns = [
url('accounts/', include('rest_registration.api.urls')),
path('accounts/', include('rest_registration.api.urls')),
]

urlpatterns = [
url('api/', include(api_urlpatterns)),
path('api/', include(api_urlpatterns)),
]
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[tox]
envlist =
py{39,38,37,36}-django40,
py{37,36}-django30,
py{37,36}-django22,
py{36,35}-django21,
py{36,35,34}-django20,
py{36,35,34}-django111,
py{37,36}-djangomaster

[testenv]
Expand All @@ -15,13 +15,13 @@ setenv =
commands = make test ARGS="-v --cov --cov-report xml"
envdir = {toxworkdir}/venv/{envname}
deps =
django111: Django>=1.11,<2.0
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22: Django>=2.2,<2.3
django30: Django>=3.0,<3.1
django31: Django>=3.1,<3.2
django32: Django>=3.2,<3.3
django40: Django>=4.0,<4.1
djangomaster: https://github.com/django/django/archive/master.tar.gz
py{35,36}-django{111,20,21,22}: djangorestframework>=3.11,<3.12
-rrequirements/requirements-test.in

0 comments on commit b47cc94

Please sign in to comment.