Re: Template problem with dates(field, kind, order='ASC')
Sorry, must have forgotton that part, it just wasn't displaying anything, its was cos I was archive.datetime, when archive was already a dateime object. Now I've changed it to {{ archive }} its fine. Thanks guys, Andrew --~--~-~--~~~---~--~~ 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: Template problem with dates(field, kind, order='ASC')
On Sep 13, 10:49 pm, djandrow <[EMAIL PROTECTED]> wrote: > This is probably really really obvious. I have the following statement > in my views.py: > > archive_list = Entry.objects.dates('entry_date', 'month', > order='DESC') > > then I have; > > {% for archive in archive_list %} > > {{ archive.datetime }} > > {% endfor %} > > in my template, i am 99.9% my problem is with {{ archive.datetime }}. > > Any help would be much appreciated, > > Andrew You don't state what the actual problem is. One thing I can see is that each value for 'archive' will be an instance of datetime.datetime, so calling datetime on it again doesn't make any sense. Are you trying to format the output? If so, use the 'date' filter. For example: {% for archive in archive_list %} {{ archive|date:"m Y" }} {% endfor %} ... which will give you a list in the format "Jan 2008 Feb 2008 Mar 2008" etc. -- 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: Template problem with dates(field, kind, order='ASC')
On Sat, Sep 13, 2008 at 11:49 PM, djandrow <[EMAIL PROTECTED]> wrote: > > This is probably really really obvious. I have the following statement > in my views.py: > > archive_list = Entry.objects.dates('entry_date', 'month', > order='DESC') > > then I have; > > {% for archive in archive_list %} > > {{ archive.datetime }} > > {% endfor %} > > in my template, i am 99.9% my problem is with {{ archive.datetime }}. > > Any help would be much appreciated, > It would be helpful if you'd include what went wrong or what did not match your expectations. Matthias --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Template problem with dates(field, kind, order='ASC')
This is probably really really obvious. I have the following statement in my views.py: archive_list = Entry.objects.dates('entry_date', 'month', order='DESC') then I have; {% for archive in archive_list %} {{ archive.datetime }} {% endfor %} in my template, i am 99.9% my problem is with {{ archive.datetime }}. Any help would be much appreciated, Andrew --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---