Commit 6720584a authored by Flavio TARSETTI's avatar Flavio TARSETTI

[accounts][signals] supervision_request signal creation/handler

parent f27f4b3a
......@@ -35,8 +35,14 @@ from django.conf import settings
from rest_framework.authtoken.models import Token
from actstream import action
from .models import AccountSettings
import django.dispatch
supervision_request = django.dispatch.Signal()
@receiver(post_save, sender=User)
def setup_user(sender, instance, created, **kwargs):
......@@ -45,3 +51,12 @@ def setup_user(sender, instance, created, **kwargs):
instance.groups.add(default_group)
Token.objects.create(user=instance)
AccountSettings.objects.create(owner=instance)
@receiver(supervision_request)
def on_supervision_request(sender, **kwargs):
action.send(
sender.supervisee,
verb="has requested supervision from",
target=sender.supervisor,
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment