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

Test and cover note app

This commit is contained in:
Yohann D'ANELLO
2020-09-01 15:54:56 +02:00
parent c6abad107a
commit 7c9287e387
7 changed files with 407 additions and 31 deletions

View File

@ -6,11 +6,7 @@ def save_user_note(instance, raw, **_kwargs):
"""
Hook to create and save a note when an user is updated
"""
if raw:
# When provisionning data, do not try to autocreate
return
if instance.is_superuser or instance.profile.registration_valid:
if not raw and (instance.is_superuser or instance.profile.registration_valid):
# Create note only when the registration is validated
from note.models import NoteUser
NoteUser.objects.get_or_create(user=instance)