Skip to content

Django app for City of Helsinki user infrastructure

License

Notifications You must be signed in to change notification settings

Tampere/django-tamusers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django app for City of Tampere user infrastructure

Installation

First, install the pip package.

pip install django-tamusers

Second, implement your own custom User model in your application's models.py.

# users/models.py

from tamusers.models import AbstractUser


class User(AbstractUser):
    pass

Then, modify your settings.py to add the tamusers 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.

INSTALLED_APPS = (
    ...
    'tamusers',
    ...
    '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 provided by django-allauth.

Then, install the allauth provider by adding tamusers.providers.tampere 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 Tampere.

You should also make sure allauth doesn't try to send verification emails by including this in your settings.py:

SOCIALACCOUNT_PROVIDERS = {
    'tampere': {
        'VERIFIED_EMAIL': True
    }
}
SOCIALACCOUNT_ADAPTER = 'tamusers.adapter.SocialAccountAdapter'
LOGIN_REDIRECT_URL = '/'
ACCOUNT_LOGOUT_ON_GET = True

About

Django app for City of Helsinki user infrastructure

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 93.0%
  • HTML 7.0%