mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2025-07-07 09:44:01 +02:00
Django upgrade
This commit is contained in:
14
users/signals.py
Normal file
14
users/signals.py
Normal file
@ -0,0 +1,14 @@
|
||||
# -*- mode: python; coding: utf-8 -*-
|
||||
# Copyright (C) 2017-2019 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
|
||||
def add_to_default_group(sender, **kwargs):
|
||||
"""
|
||||
When creating a new user, add it to users group
|
||||
"""
|
||||
user = kwargs["instance"]
|
||||
if kwargs["created"]:
|
||||
from django.contrib.auth.models import Group
|
||||
group, group_created = Group.objects.get_or_create(name='users')
|
||||
user.groups.add(group)
|
Reference in New Issue
Block a user