Re: How to display a date in my template as Mar. 1 2008...not 2008-03-01?

2008-03-02 Thread David Marquis

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  
template filters.


--
David

On 2-Mar-08, at 1:14 PM, Greg wrote:



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.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...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

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---





smime.p7s
Description: S/MIME cryptographic signature


Re: How to display a date in my template as Mar. 1 2008...not 2008-03-01?

2008-03-02 Thread Evert Rol

> 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.date|date:"jS o\f F" }}  ?

I guess the confusion arose because the date filter points to the now  
tag for the formatting details, and tags have a slightly different  
syntax than filters of course.



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to display a date in my template as Mar. 1 2008...not 2008-03-01?

2008-03-02 Thread Greg

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 '2008-03-01' (when i just use
{{ a.date }} ).

Thanks




On Mar 2, 1:37 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> 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)
> > location = models.CharField(maxlength=100)
> > state = models.USStateField()
> > date = models.DateField()
> > comment = models.TextField(maxlength=5000)
>
> It's a variable, not a tag, so use {{ a.date|date "jS o\f F" }} - ie
> {{ }}, rather than {% %}.
>
> --
> DR.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to display a date in my template as Mar. 1 2008...not 2008-03-01?

2008-03-02 Thread Daniel Roseman

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)
> location = models.CharField(maxlength=100)
> state = models.USStateField()
> date = models.DateField()
> comment = models.TextField(maxlength=5000)
>

It's a variable, not a tag, so use {{ a.date|date "jS o\f F" }} - ie
{{ }}, rather than {% %}.

--
DR.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to display a date in my template as Mar. 1 2008...not 2008-03-01?

2008-03-02 Thread Greg

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.USStateField()
date = models.DateField()
comment = models.TextField(maxlength=5000)



On Mar 2, 12:38 pm, "Justin Lilly" <[EMAIL PROTECTED]> wrote:
> 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 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.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...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
>
> --
> Justin Lilly
> Web Developer
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to display a date in my template as Mar. 1 2008...not 2008-03-01?

2008-03-02 Thread Justin Lilly
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 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.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...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
> >
>


-- 
Justin Lilly
Web Developer

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to display a date in my template as Mar. 1 2008...not 2008-03-01?

2008-03-02 Thread Greg

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.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...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
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to display a date in my template as Mar. 1 2008...not 2008-03-01?

2008-03-02 Thread [EMAIL PROTECTED]

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...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
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---