mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
15 lines
478 B
Python
15 lines
478 B
Python
# apps/accounts/signals.py
|
|
# Example: automatically create something on user creation
|
|
|
|
from django.db.models.signals import post_save
|
|
from django.dispatch import receiver
|
|
from .models import User
|
|
|
|
|
|
@receiver(post_save, sender=User)
|
|
def handle_new_user(sender, instance, created, **kwargs):
|
|
if created:
|
|
# e.g. initialize default avatar config
|
|
if not instance.avatar_config:
|
|
instance.avatar_config = {"style": "circle"}
|
|
instance.save()
|