20 lines
500 B
Python
20 lines
500 B
Python
|
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,
|
||
|
)
|