1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-21 18:32:37 +00:00
seahub/contacts/handlers.py

19 lines
473 B
Python
Raw Normal View History

from signals import mail_sended
from models import Contact
def mail_sended_cb(sender, **kwargs):
"""
Callback function to add email to contacts.
"""
user = kwargs['user']
email = kwargs['email']
try:
Contact.objects.get(user_email=user, contact_email=email)
# Already in contacts list, pass.
except Contact.DoesNotExist:
# Add new contact
c = Contact(user_email=user, contact_email=email)
c.save()