Django_rest_api/backend/ecommerce/signals.py

10 lines
343 B
Python
Raw Normal View History

from django.db.models.signals import post_save
from django.dispatch import receiver
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
@receiver(post_save, sender=User, weak=False)
def report_uploaded(sender, instance, created, **kwargs):
if created:
Token.objects.create(user=instance)