Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
apply default_if_none filter type behavior in admin fields?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Some Guy  
View profile  
 More options Jul 3 2009, 6:43 pm
From: Some Guy <djul...@gmail.com>
Date: Fri, 3 Jul 2009 15:43:42 -0700 (PDT)
Local: Fri, Jul 3 2009 6:43 pm
Subject: apply default_if_none filter type behavior in admin fields?
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?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Some Guy  
View profile  
 More options Jul 3 2009, 6:46 pm
From: Some Guy <djul...@gmail.com>
Date: Fri, 3 Jul 2009 15:46:18 -0700 (PDT)
Local: Fri, Jul 3 2009 6:46 pm
Subject: Re: apply default_if_none filter type behavior in admin fields?
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:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google