from django.dispatch import receiver
from django.db.models.signals import post_delete, post_save


from post_office import mail
from django.core.mail import EmailMessage
from django.core.mail import EmailMultiAlternatives

from .models import *



@receiver(post_save, sender=Product)
def search_agent(sender, instance, update_fields=None, **kwargs):
    print(instance)
    print(sender)
    print(update_fields)
    if update_fields != None:
        print(update_fields)
        if 'frei' in update_fields:
            print('frei updated')


#
#
# @receiver(user_sign_up_attempt)
# def handle_user_sign_up_attempt(sender, **kwargs):
#     log(
#         user=None,
#         action="SIGNUP_ATTEMPTED",
#         extra={
#             "username": kwargs.get("username"),
#             "email": kwargs.get("email"),
#             "result": kwargs.get("result")
#         }
#     )
#
#
# @receiver(user_signed_up)
# def handle_user_signed_up(sender, **kwargs):
#     log(
#         user=kwargs.get("user"),
#         action="USER_SIGNED_UP",
#         extra={}
#     )
