Alfonso,

If you ar using text e-mail you can just use: ', '.join(order_list) or
'\n'.join(order_list)

Another way, is using a string (nice for sending HTML e-mails):

order_list = CustomerBasket.objects.all()
customer = UserProfile.objects.get(user=user).customer
body = ''

for item in order_list:
    body += '<strong>%s</strong>: %s<br />' % (item.attribute1,
item.attribute2)

email = EmailMessage(
        'New Customer Order: %s ' % customer,
        body, to = ['email']
)
email.send()

I hope that helps you.

A Melé
http://django.es


On 3 mar, 12:52, Alfonso <allanhender...@gmail.com> wrote:
> Thinking this should be easy but not sure of the correct path to
> success!
>
> Got a simple filter queryset that pulls order products from a db:
>
> order_list = CustomerBasket.objects.all()
> customer = UserProfile.objects.get(user=user).customer
> email = EmailMessage(
>         'New Customer Order: %s ' % customer,
>         '%s' % order_list, to = ['email']
> )
> email.send()
>
> So when running the  above I get this in the sent email:
>
> [<CustomerBasket: 2>, <CustomerBasket: 3>, <CustomerBasket: 4>]
>
> At least it's sending the email :-)  My question is, what's a
> straightforward way to iterate through the items in 'order list' and
> print them nicely in the email body.
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to