chess_rpg_backend/game/signals.py

12 lines
387 B
Python
Raw Normal View History

from django.db.models.signals import post_save
from django.dispatch import receiver
2022-07-08 01:16:41 +03:00
from .models import Player, PlayerAuthSession
from .services.deck_handler import create_first_deck
@receiver(post_save, sender=Player)
def create_player(sender, instance, created, **kwargs):
if created:
PlayerAuthSession.objects.create(player=instance)
create_first_deck(instance)