It's the default behavior of Python:

>>> str(None)
'None'

I don't agree that it should be the default. None and "" are two
distinct values -- especially with a database. In databases, None (or
NULL) normally represents a _missing_ value, whereas a "" is one that
was intentionally specified to be blank.

On Jul 11, 6:12 pm, Rand  Bradley <[EMAIL PROTECTED]> wrote:
> The default_if_none filter was not working when I tried it the first
> time, but I retried it after your post and it is working so this may
> solve my issue.
>
> Is that the designed behavior template variables? If the value is
> None, display the word "None"? So someone has to use the
> default_if_none filter or use a conditional expression in order to
> render an empty string for all variables that have the potential value
> of None? In my opinion, this seems counter-intuitive, and a better
> approach might be to render an empty string by default, and use the
> default_if_none filter to render the word 'None' if desired.
>
> On Jul 11, 4:15 pm, "Chris Brand" <[EMAIL PROTECTED]> wrote:
>
> > When a template variable value is None, is it expected to render the word
> > 'None'? I would expect this to fail silently instead of displaying the word.
> > Is there a configuration setting or some way to change the default
> > rendering? Do I have to wrap variables with an {% if ... %} in order to not
> > display None? I would appreciate any suggestions on how to handle the
> > display of variables equal to None.
>
> > Are you looking for this :
>
> >http://www.djangoproject.com/documentation/templates/#default-if-none
>
> > Chris


--~--~---------~--~----~------------~-------~--~----~
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