Django app for the user infrastructure of the City of Helsinki
Project description
=====
Django app for City of Helsinki user infrastructure
=====
Installation
------------
First, install the pip package.
.. code:: shell
pip install django-helusers
Second, implement your own custom User model in your application's
``models.py``.
.. code:: python
# users/models.py
from helusers.models import AbstractUser
class User(AbstractUser):
pass
Then, modify your ``settings.py`` to add the ``helusers`` app as the
first app (or at least before the ``django.contrib.admin`` app. You need
to also point Django to use your custom User model.
.. code:: python
INSTALLED_APPS = (
...
'helusers',
...
'users'
)
AUTH_USER_MODEL = 'users.User'
OAuth2 provider
---------------
If you want to use the City's OAuth2 API, you need to install the
``django-allauth`` package. Follow the `installation instructions
<http://django-allauth.readthedocs.org/en/latest/installation.html>`_
provided by ``django-allauth``.
Then, install the allauth provider by adding ``helusers.providers.helsinki``
to your ``INSTALLED_APPS``.
After allauth is correctly set up, you need to create a ``SocialApp``
instance. You can do it through the Django admin interface (Social Applications).
You will be provided the client id and secret key by the City of Helsinki.
You should also make sure ``allauth`` doesn't try to send verification emails
by including this in your ``settings.py``:
.. code:: python
SOCIALACCOUNT_PROVIDERS = {
'helsinki': {
'VERIFIED_EMAIL': True
}
}
SOCIALACCOUNT_ADAPTER = 'helusers.providers.helsinki.provider.SocialAccountAdapter'
LOGIN_REDIRECT_URL = '/'
ACCOUNT_LOGOUT_ON_GET = True
Django app for City of Helsinki user infrastructure
=====
Installation
------------
First, install the pip package.
.. code:: shell
pip install django-helusers
Second, implement your own custom User model in your application's
``models.py``.
.. code:: python
# users/models.py
from helusers.models import AbstractUser
class User(AbstractUser):
pass
Then, modify your ``settings.py`` to add the ``helusers`` app as the
first app (or at least before the ``django.contrib.admin`` app. You need
to also point Django to use your custom User model.
.. code:: python
INSTALLED_APPS = (
...
'helusers',
...
'users'
)
AUTH_USER_MODEL = 'users.User'
OAuth2 provider
---------------
If you want to use the City's OAuth2 API, you need to install the
``django-allauth`` package. Follow the `installation instructions
<http://django-allauth.readthedocs.org/en/latest/installation.html>`_
provided by ``django-allauth``.
Then, install the allauth provider by adding ``helusers.providers.helsinki``
to your ``INSTALLED_APPS``.
After allauth is correctly set up, you need to create a ``SocialApp``
instance. You can do it through the Django admin interface (Social Applications).
You will be provided the client id and secret key by the City of Helsinki.
You should also make sure ``allauth`` doesn't try to send verification emails
by including this in your ``settings.py``:
.. code:: python
SOCIALACCOUNT_PROVIDERS = {
'helsinki': {
'VERIFIED_EMAIL': True
}
}
SOCIALACCOUNT_ADAPTER = 'helusers.providers.helsinki.provider.SocialAccountAdapter'
LOGIN_REDIRECT_URL = '/'
ACCOUNT_LOGOUT_ON_GET = True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-helusers-0.2.4.tar.gz
(8.1 kB
view hashes)
Built Distribution
Close
Hashes for django_helusers-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0942b5e3558a2750ef4a7c4a74b68c3e0b76a9c0e18fe7860e5aa9563ce88392 |
|
MD5 | 991e09d1eb55e37419e40510e683c81f |
|
BLAKE2b-256 | ea19ed7e766ab61804b88b50de9f12aa9076e1d8a0c99a8a3c016d14e9ca7891 |