Re: Creating an Archive
I solved this problem, for those who come after me, you can use: Entry.objects.dates('entry_date', 'month', order='DESC') where entry is the name of the table/model and entry_date is the name of the date field. This returns a list of months with objects in. Thanks for everyone's help, 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: Creating an Archive
I would make a script that ran through my database and flagged this as archived (this should be a boolean flag) On Fri, Sep 12, 2008 at 1:33 PM, djandrow <[EMAIL PROTECTED]> wrote: > > Do i need to pass the months into the view using extra_context? > > Andrew > > > -- http://www.goldwatches.com/ --~--~-~--~~~---~--~~ 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: Creating an Archive
Do i need to pass the months into the view using extra_context? 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: Creating an Archive
Thanks Russ, I'm still abit confused about the first part, I understand it prints 2008-01-01, because its printing the years with entries in them, and 2008 is the only year with entries, but rather than get it to show all the years with entries I want it to show all the months with entries in. I had a look at the documentation: http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-date-based-archive-index I am none the wiser though, how do I pass the months into the view? I appreciate the help on the date format and the views, thanks, 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: Creating an Archive
On Wed, Sep 10, 2008 at 4:31 AM, djandrow <[EMAIL PROTECTED]> wrote: > I just get 2008-01-01, i guess thats cos I only have entries in 2008 > and the date is formatted wrongly, so my question is how can i get a > list of months, like you find on any archive links; September 2008, > October 2008 etc. Well - the template is printing exactly what you asked it to. You give it a list of all dates where you have entries, and it prints a single date - in the default format. If you want a different list of dates to be printed, then you will need to pass that list into your view so your template can iterate over it. Make sure you handle the case where no entries are available, either by not rendering those dates as links, or making sure that you have the empty case handled on the view. As for formatting the date, Django provides filters that can do this: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date > 2. At the moment i've just been testing the generic view in a template > which does nothing else apart from show archive links, how can I > incorporate this with my main template (the index page I already have) > which uses views? The same way you incorporate any other piece of a Django template - using {% extends %} http://docs.djangoproject.com/en/dev/ref/templates/builtins/#extends Yours Russ Magee %-) --~--~-~--~~~---~--~~ 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: Creating an Archive
Can no one help me with either of my questions? I'd really like to this sorted. Thanks, 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 -~--~~~~--~~--~--~---
Creating an Archive
Hello, I currently have a website which I am trying to add an archive to, i currently have the following date based URLs: (r'^$', 'django.views.generic.date_based.archive_index', archive_info), (r'^(?P\d{4})/$', 'django.views.generic.date_based.archive_year', archive_info), (r'^(?P\d{4})/(?P[a-z]{3})/$', 'django.views.generic.date_based.archive_month', archive_info), (r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? P[-\w]+)/$', 'django.views.generic.date_based.object_detail', archive_info), my archive info dict contains the following: archive_info = { 'queryset' : Entry.objects.all(), 'date_field' : 'entry_date', 'template_name' : 'blog/archive.html', } Now I have 2 questions about this: 1. I understand that to get your standard archive you use links on your home you use 'django.views.generic. date_based.archive_index', however if i use: {% for dates in date_list %} {{ dates.date }} {% endfor %} I just get 2008-01-01, i guess thats cos I only have entries in 2008 and the date is formatted wrongly, so my question is how can i get a list of months, like you find on any archive links; September 2008, October 2008 etc. 2. At the moment i've just been testing the generic view in a template which does nothing else apart from show archive links, how can I incorporate this with my main template (the index page I already have) which uses views? I would be grateful for any help or advice. 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: Creating an archive navigation for date_based.archive_month
> Hope this helps, > Chris It did indeed! I suspected a tag was the way to go, but I hadn't had time to properly introduce myself to writing tags. I shamelessly nicked your code, and now I have what I need: http://max.romantschuk.fi/blog/ (See the left sidebar. Note: DNS just started pointing to the Django server.) I've ported my site in a week from an old proprietary CMS, and I must say Django's been a pleasure so far! Thanks again, Chris! Max --~--~-~--~~~---~--~~ 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: Creating an archive navigation for date_based.archive_month
Here's how I've done it on my blog. Use this tag (which I pulled from somewhere else on the web)- http://www.satchmoproject.com/trac/browser/satchmoproject.com/satchmo_website/apps/blog/templatetags/month-list.py Here's the template that uses the tag- http://www.satchmoproject.com/trac/browser/satchmoproject.com/satchmo_website/templates/base_blog.html Hope this helps, Chris --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Creating an archive navigation for date_based.archive_month
I'm in the process of porting my site to Django, and I'm wondering how to best implement a monthly archive navigation like in Django's weblog's sidebar: http://www.djangoproject.com/weblog/ I'm using generic views. I basically need the information provided in date_based.archive_year: the months which have items. But that is a view, and I want to get the same information into the sidebar of my site. How should I do that? I just started using Django a week ago, so this might indeed be really simple. I haven't had time to thoroughly digest the docs just yet... Thanks in advance, Max Romantschuk --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---