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

upgrade oauth to support django 4+ #23

Merged
merged 13 commits into from
Dec 8, 2023
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@ Step 1: `pip install django-admin-oauth2` and include it in your project's requi

Step 2: Include the django-admin-oauth2 urlconf in your project's urls.py:

Django 1.x

```python
url(r'/admin/oauth/', include('oauthadmin.urls'))
```

Django >= 2.0

```python
re_path(r'/admin/oauth/', include('oauthadmin.urls'))
```

Step 3: Include oauthadmin in your INSTALLED_APPS:

```python
Expand Down Expand Up @@ -85,6 +93,7 @@ When the CSRF validation token doesn't match, django-admin-oauth2 will redirect


## Changelog
* 1.2.1: Add support for django 4, retain backwards compat with Django 1.x
* 1.2.0: Allow overriding oauth scope with new parameter, OAUTHADMIN_SCOP
* 1.1.3: Bugfix in adminsite (tabs vs spaces)
* 1.1.2: Add support for django 2
Expand Down
15 changes: 10 additions & 5 deletions oauthadmin/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
from django.conf.urls import url
import oauthadmin.views

try:
from django.urls import re_path as url
except ImportError:
from django.conf.urls import url


urlpatterns = [
url(r'login/', oauthadmin.views.login),
url(r'callback/', oauthadmin.views.callback),
url(r'logout/', oauthadmin.views.logout),
url(r'logout_redirect/', oauthadmin.views.logout_redirect),
url(r"login/", oauthadmin.views.login),
url(r"callback/", oauthadmin.views.callback),
url(r"logout/", oauthadmin.views.logout),
url(r"logout_redirect/", oauthadmin.views.logout_redirect),
]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

setup(
name='django-admin-oauth2',
version='1.2.0',
version='1.2.1',
description='A django app that replaces the django admin authentication mechanism by deferring to an oauth2 provider',
long_description=README,
url='https://github.com/RealGeeks/django-admin-oauth2',
Expand Down