Reputation: 25
I'm testing django signal to send an email but I'm getting the following error.
'list' object has no attribute 'splitlines'
@receiver(post_save, sender=Booking)
def new_booking(sender, instance, **kwargs):
if instance.firstname:
firstname = [instance.firstname]
# lastname = [instance.lastname]
email = [instance.email]
# phone = [instance.phone]
subject = [instance.service]
# date = [instance.date]
# time = [instance.time]
# fullname = [firstname + lastname]
# details = [service]
send_mail(firstname, subject, email,
['[email protected]'], fail_silently=False)
Do i miss something?
Thanks again!
Upvotes: 1
Views: 1223
Reputation: 25
Got this working... if someone needs it... here's the code...
from .models import Booking
@receiver(post_save, sender=Booking)
def new_booking(sender, instance, **kwargs):
if instance.firstname:
firstname = (instance.firstname)
email = (instance.email)
subject = (instance.service)
send_mail(firstname, subject, email,
['[email protected]'], fail_silently=False)
Upvotes: 1