Of course it should be default_if_none template tag, but it mangled my
link

On Jul 3, 3:43 pm, Some Guy <djul...@gmail.com> wrote:
> Hi,
> I wonder if anyone has ideas about the best way to do this.
>
> My field shows up as (None) in the change_list view on admin.  I would
> love to have a behavior similar to <a href="http://
> docs.djangoproject.com/en/dev/ref/templates/builtins/#default-if-
> none">default_if_none</a> template tag.
>
> My Ideas  --------------------
>
> 1. making a new template just for this seems difficult.
>
> 2.I could make a function in the model that returns '' if the actual
> field is None...
> like
>
> cost = models.DecimalField
> def display_cost(self):
>     if self.cost:
>         return self.cost
>     else:
>         return ' '
>
> But if I wanted to do this for many fields it could get pretty ugly
> ------------------------------------
>
> What would be the best way of these two? Or is there some way I
> haven't thought of?
--~--~---------~--~----~------------~-------~--~----~
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