Re: Model's optional __unicode__() return values?
Hi Chris! Thanks so much for your quick reply, I really appreciate it.
On Fri, Dec 14, 2012 at 3:41 PM, Chris Cogdon <chris@cogdon.org> wrote:
> oops... that should be "if x is not None", not "where x is not None"...
> Clearly I am still half in SQL mode :)
Sweet!!! Works perfectly:
return ' | '.join ([unicode(x) for x in (self.target, getattr(self,
'page_type', None)) if x is not None])
Much appreciated. :)
Have a nice holiday.
Cheers,
Micky
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home