I'm trying to display the latest 5 posts using a generic view like this:
urlpatterns = patterns('',
  (r'^$', 'django.views.generic.date_based.archive_index', 
  {
      'queryset': Post.objects.all()[:5], 
      'date_field': 'created_on', 
      'template_name': 'index.html'}
  })
However I am getting
Asser开发者_Python百科tionError at /
Cannot filter a query once a slice has been taken.
What can I do?
num_latest: The number of latest objects to send to the template context. By default, it's 15.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论