Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 326145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:16:56+00:00 2026-05-12T09:16:56+00:00

I am using Django’s generic views to create a blog site. The templates I

  • 0

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 valid page with no content (not a 404 or other error. It looks like it sees no objects in **object_list**.

I know that archive uses a latest list instead of object_list,
but that’s not the case with archive_year, correct?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:16:57+00:00Added an answer on May 12, 2026 at 9:16 am

    To solve your problem:

    If you set make_object_list=True when calling archive_year, then the list of objects for that year will be available as object_list.

    As a quick example, if your url pattern looks like

    url(r'^(?P<year>\d{4})/$', 'archive_year', info_dict, name="entry_archive_year")
    

    where info_dict is a dictionary containing the queryset and date_field, change it to

    url(r'^(?P<year>\d{4}/$', 'archive_year', dict(info_dict,make_object_list=True),
            name="entry_archive_year")
    

    Explanation:

    The generic view archive_year has an optional argument make_object_list. By default, it is set to false, and object_list is passed to the template as an empty list.

    make_object_list: A boolean specifying whether to retrieve the full list of objects for this year and pass those to the template. If True, this list of objects will be made available to the template as object_list. (The name object_list may be different; see the docs for object_list in the “Template context” section below.) By default, this is False.

    A reason for this is that you might not always want to display the entire object list in the entry_archive_year view. You may have hundreds of blog posts for that year, too many to display on one page.

    Instead, archive_year adds date_list to the template context. This allows you to create links to the monthly archive pages of that year, for the months which have entries.

    date_list: A list of datetime.date objects representing all months that have objects available in the given year, according to queryset, in ascending order.

    There’s more info in the Django docs.

    As requested in the comment below, an example of how to use date_list:

    To use date_list, your entry_archive_year template would contain something like this:

    <ul>
      {% for month in date_list %}
    
        <li><a href="/blog/{{month|date:"Y"}}/{{month|date:"b"}}>
              {{month|date:"F"}}</a></li>
      {% endfor %}
    </ul>
    

    Note that I’ve hardcoded the url – in practice it would be better to use the url template tag. For an example of date_list being used in the wild, look at the Django Weblog 2009 Archive.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I using Django and a generic view django.views.generic.create_update.create_object I have a model form wich
Im using Django 1.2.3. I have login functionality in my site using django.contrib.auth.views.login .
I am using django generic views, how do I get access to the request
Using Django templates in Google App Engine (on Python), is it possible to compare
Using Django 1.1.1 In models.py: class Site(models.Model): name = models.CharField(max_length=50) class SiteMonth(models.Model): site =
I am using Django to develop a course registration site for an educational institution.
Using Django 1.1, how could I create a crosstab (pivot table) SQL query using
When using Django's built in comment package, where is the table created when the
im using django-registration, all is fine, the confirmation email was sending in plain text,
When using Django's get_or_create(), when created=True, is there any way to make it so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.