Well, I am embarrassed to admin that this issue was 100% user error. I recently set up a dev and production server and copied everything from the old production server to the two new servers.
I was testing the search results page on dev, that's the page that generates the links to the pages that I'm having issue with (they appear in a pop up, BTW). While the search results page was on dev the actual page that was having the age issue was on production. So as I edited the templates for the age pages on dev it was not updating production so that's why i couldn't get the simple "if" statements to work. I had full absolute URLS to the age pages, they've been changed to relative URLS to prevent this from happening. There is, however, a bright side to my ignorance. The suggestions to update the template tag filter were right on. I use this filter a lot so it makes more since to have a built in fail safe rather than checking in the templates each time. Thanks a bunch, Dummy On May 12, 12:46 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Wed, May 12, 2010 at 1:06 PM, Nick <nickt...@gmail.com> wrote: > > I am using a custom template tag called calculate age to produce an > > age in numbers based on a filter for a template tag. > > > Here is the tag: > > > def age(bday, d=None): > > if d is None: > > d = datetime.datetime.now() > > return (d.year - bday.year) - int((d.month, d.day) < (bday.month, > > bday.day)) > > > register.filter('age', age) > > > here is how it is used in a template: > > > {{ entry.DOB|age }} # that produces an age > > > Here is the problem, not all of the entries in my DB have a date of > > birth (henceforth known as DOB). > > > This raises and error. > > [snip remainder] > > Why not just handle it in the age filter itself: > > def age(bday, d=None): > if not bday: > return 'N/A' > if d is None: > d = datetime.datetime.now() > ... remainder of filter ... > > ? > > Karen > --http://tracey.org/kmt/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.