Or rather :
{% for a in entries %}
Date: {{ a.date|date:"jS o\f F" }}
{% endfor %}
--
David
Begin forwarded message:
From: David Marquis <[EMAIL PROTECTED]>
Date: March 2, 2008 8:15:00 PM EST (CA)
To: django-users@googlegroups.com
Subject: Re: How to display a date i
You forgot the pipe | character and the colon :
{% for a in entries %}
Date: {% a.date|date:"jS o\f F" %}
{% endfor %}
If a is your date, then:
{% for a in entries %}
Date: {% a|date:"jS o\f F" %}
{% endfor %}
Have you read the docs? They are pretty clear about the syntax of
templa
> Daniel,
> Now i'm getting the error:
>
> Could not parse the remainder: ' "jS o\f F"' from 'a.date|date "jS o\f
> F"'
>> It's a variable, not a tag, so use {{ a.date|date "jS o\f F" }} - ie
>> {{ }}, rather than {% %}.
>
Shouldn't there be a colon between the filter and its arguments:
{{ a.dat
Daniel,
Now i'm getting the error:
Could not parse the remainder: ' "jS o\f F"' from 'a.date|date "jS o\f
F"'
///
I just looked at my Admin. And when I open each record I see the
value 'True' in my date field. However, when I look at it in the
template it shows the correct date '2
On 2 Mar, 18:45, Greg <[EMAIL PROTECTED]> wrote:
> Justin,
> I tried that but I'm still getting the following error:
>
> Invalid block tag: 'a.date|date'
>
>
>
> My Model file is setup this way:
>
> class Guestbook(models.Model):
> name = models.CharField(maxlength=100)
> loca
Justin,
I tried that but I'm still getting the following error:
Invalid block tag: 'a.date|date'
My Model file is setup this way:
class Guestbook(models.Model):
name = models.CharField(maxlength=100)
location = models.CharField(maxlength=100)
state = models.USStateFiel
Assuming a.date is a valid datetime, you're probably looking for:
{% for a in entries %}
Date: {% a.date|date "jSo\f F" %}
{% endfor %}
which is explained on the previous link.
On Sun, Mar 2, 2008 at 1:14 PM, Greg <[EMAIL PROTECTED]> wrote:
>
> Alex,
> I tried that however I get the following
Alex,
I tried that however I get the following error: TemplateSyntaxError:
Invalid block tag: 'a.date'
Here is my template
{% for a in entries %}
Date: {% a.date "jS o\f F" %}
{% endfor %}
On Mar 2, 12:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Use the date filter:http://www.d
Use the date filter: http://www.djangoproject.com/documentation/templates/#date
On Mar 2, 11:57 am, Greg <[EMAIL PROTECTED]> wrote:
> I'm querying a table in my db. Each record that gets returned
> contains a DateField (the date it was created). I'm able to show the
> date in the template...how
I'm querying a table in my db. Each record that gets returned
contains a DateField (the date it was created). I'm able to show the
date in the template...however I want to change the format it's being
displayed as. In this case it's 2008-03-01. I want the date to show
Mar. 1 2008.
Thanks
--~
10 matches
Mail list logo