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

Some initial data

This commit is contained in:
Alexandre Iooss
2020-02-20 22:10:10 +01:00
parent 7a418be2c4
commit a304f6a97d
3 changed files with 256 additions and 2 deletions

View File

@ -2,20 +2,28 @@
# SPDX-License-Identifier: GPL-3.0-or-later
def save_user_note(instance, created, **_kwargs):
def save_user_note(instance, created, 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 created:
from .models import NoteUser
NoteUser.objects.create(user=instance)
instance.note.save()
def save_club_note(instance, created, **_kwargs):
def save_club_note(instance, created, raw, **_kwargs):
"""
Hook to create and save a note when a club is updated
"""
if raw:
# When provisionning data, do not try to autocreate
return
if created:
from .models import NoteClub
NoteClub.objects.create(club=instance)