1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 09:58:23 +02:00

Users have now automatically an attached profile to a user (fix an old bug)

This commit is contained in:
Yohann D'ANELLO
2020-02-27 15:36:12 +01:00
parent d316c3130c
commit 3c52c1d002
2 changed files with 26 additions and 0 deletions

View File

@ -1,2 +1,15 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
def save_user_note(instance, created, raw, **_kwargs):
"""
Hook to create and save a profile when an user is updated if it is not registered with the signup form
"""
if raw:
# When provisionning data, do not try to autocreate
return
if created:
from .models import Profile
Profile.objects.get_or_create(user=instance)
instance.profile.save()