poulpe/event/signals.py

20 lines
500 B
Python
Raw Normal View History

2017-07-21 15:48:40 +02:00
from django.dispatch import receiver
from django.db.models.signals import post_save
from event.models import Event
from shared.models import GEGroup
@receiver(post_save, sender=Event)
def create_groups_for_event(sender, **kwargs):
event, created = kwargs["instance"], kwargs["created"]
if created:
GEGroup.objects.create(
name="orga",
event=event
)
GEGroup.objects.create(
name="participants",
event=event,
)