src/notes/signals.py
author ymh <ymh.work@gmail.com>
Wed, 19 Jul 2017 15:57:13 +0200
changeset 119 8ff8e2aee0f9
parent 117 9864fe2067cd
child 131 adad5563603c
permissions -rw-r--r--
add parameter to filter session and note by updated date. Add pagination on sessions and notes. add read only endpoint at root level to list notes

"""
Signals for notes app
"""
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.contrib.auth.models import Group
from notes.models import GroupProfile

@receiver(post_save, sender=Group, dispatch_uid="group_created_signal")
def group_saved_callback(sender, instance, **kwargs):
    created = kwargs.pop('created')
    if instance and created:
        profile = GroupProfile(group=instance)
        profile.save()