General view of 'archive_year' creates a blank page

I use general Django views to create a blog site. I started templates, entry_archive_day, entry_archive_month, entry_archive, and entry_detaileverything works fine.

But no. Instead, it is simply a valid page with no content (not a 404 or other error. It looks like it does not see objects in . entry_archive_year**object_list**

I know that archiveuses a latestlist instead object_list, but what is not the case with archive_year, right?

Thanks!

+3
source share
1 answer

To solve your problem:

make_object_list=True archive_year, object_list.

, url

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

info_dict - , queryset date_field,

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

:

archive_year make_object_list. false, object_list .

make_object_list: , , . True, object_list. ( object_list , . object_list " " .) False.

, entry_archive_year. , .

archive_year date_list . , , .

date_list: datetime.date, , , , .

Django docs.

, date_list:

date_list, entry_archive_year :

<ul>
  {% for month in date_list %}

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

, url - url. date_list Django Weblog 2009.

+5

Source: https://habr.com/ru/post/1714824/


All Articles