from django.contrib.auth import get_user_model from django.contrib.sites.shortcuts import get_current_site from django.db.models import Sum from django.db.models.signals import post_save, pre_save from django.dispatch import receiver from .models import Album from .tasks import send_new_album_notification @receiver(post_save, sender=Album) def post_save_album_instance(sender, instance, created, **kwargs): if created: send_new_album_notification.delay(instance.id)