And the test case for Django templates is:

>>> class Money:
...     def __init__(self, amount, currency):
...         self.amount = amount
...         self.currency = currency
...     def __str__(self):
...         return 'str %s %s' % (self.currency, self.amount)
...     def __html__(self):
...         # Always show amount and currency on same line
...         return 'html %s %s' % (self.currency, self.amount)
...
>>> from django.template import Context, Engine
>>> Engine().from_string('{{foo}}').render(Context({'foo': Money('1', '$')}))
'str $ 1'

This should return 'html $ 1'.

-- 
Aymeric.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/937826E3-338A-411D-A260-26BA6D3EA0F4%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to