Doug,
I'm sending the email from my view so I can't use a template filter
like 'stringformt'.  I don't call a template to send my email.  Here
is my code view:

o = Order()
o.b_name = request.session['orderdetails']['b_firstname'] + " " +
request.session['orderdetails']['b_lastname']
o.b_address = request.session['orderdetails']['b_address']
o.b_city = request.session['orderdetails']['b_city']
o.b_state = request.session['orderdetails']['b_state']
o.b_zip = request.session['orderdetails']['b_zip']
o.amount = pr
phonemes =  "%s \n\n %s" % (pr, myorder)
send_mail('New Order', phonemes, '[EMAIL PROTECTED]',
['[EMAIL PROTECTED]'], fail_silently=False)

/////////////////////////

In this case the price always shows as 74.0.  I can't use the
following in my view:

pr = {{ order.amount|stringformat:".2f" }}

////////////////

Thanks for any help



On Oct 17, 10:25 am, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> On Oct 17, 9:44 am, Greg <[EMAIL PROTECTED]> wrote:
>
> > Doug,
> > Thanks for the reply.  It's weird, because in my admin when I show the
> > amount in my list_display (list_display = ('b_name', 'thirdtime',
> > 'amount', 'customer', 'id')).  I see the two zeroes.  However, when I
> > drill down on a specific record I only see one zero.  This is a
> > problem because in my view I send an email to the customer.  The email
> > contains the price of the order, and If the price of the order is
> > 74.00...I don't want them to see 74.0.
>
> > Thanks for any help
>
> If you're only concern is what goes into that email (presumably a
> Django template), then you can simply format the value as Michael
> specified above:  {{ order.amount|stringformat:".2f" }}.
>
> If you're unhappy with how the Admin is displaying the value for edit
> in a form field, I believe you'll need to look into creating your own
> custom AddManipulator and ChangeManipulator for your Order object.
> The oldforms documentation has details on that.
>
> Again, though, if you're only concerned with the output in a template
> (your email), then just use the stringformat filter.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to