I am using Django's generic views to create a blog site.  The
templates I created, entry_archive_day, entry_archive_month,
entry_archive, and entry_detail all work perfectly, but
entry_archive_year does not.

Instead, it is simply a blank page.  It looks like it sees no objects
in 'object_list'.

Details are included below:

====
urls.py
====

entry_info_dict = {
                   'queryset': Entry.objects.all(),
                   'date_field': 'pub_date',
                   }

...

(r'^weblog/$',
     'django.views.generic.date_based.archive_index', # works with
'latest', not 'object_list'
     entry_info_dict),
    # Weblog by year
    (r'^weblog/(?P<year>\d{4})/$',
     'django.views.generic.date_based.archive_year', # doesn't work
     entry_info_dict),
    # Weblog by month
    (r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/$',
     'django.views.generic.date_based.archive_month',
     entry_info_dict),
    # Weblog by day
    (r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',
     'django.views.generic.date_based.archive_day',
...

============
entry_archive_year:
============

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
        <title>Entry Archive {{ year }}</title>
    </head>
    <body>
        {% for object in object_list %}
            <h2>{{ object.title }}</h2>
            <p>
                Published on {{ object.pub_date|date:"F j, Y" }}
            </p>
            {% if object.excerpt_html %}
               {{ object.excerpt_html|safe }}
            {% else %}
               {{ object.body_html|truncatewords_html:"50"|safe }}
            {% endif %}
            <p>
                <a href="{{ object.get_absolute_url }}">Read full
entry</a>
            </p>
        {% endfor %}
    </body>
</html>

==============================================
Output for http://localhost:8000/weblog/2009/aug/ (notice 3 entries
for August):
==============================================

Latest!

Published on August 9, 2009

Specific areas for enhancement:

* Adding related objects should be easier. Now you have to "save and
continue" to get an extra set of fields to add a new related object.
You should be able to click "add new object" to add another set of
blank fields inline on the page ...

Read full Entry
Practical Django Projects

Published on August 9, 2009

It also will keep track of open tags and close them if it cuts off the
text before a closing tag. (A sep- arate filter, truncatewords, simply
cuts off at the specified number of words and pays no attention to
HTML.)

Read full Entry
Star Wars

Published on August 6, 2009

Star Wars used to be a great movie series.

Read full Entry

===========================================
Output for http://localhost:8000/weblog/2009/ is a blank page (no
errors).  There should be at least 3 entries, demonstrated by
August.
===========================================

Thanks,
Matthew
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to