0

This is my blog/urls.py file and i am in Django 1.6, when i run my server it complains : Could not import django.views.generic.date_based.archive_index. Parent module django.views.generic.date_based does not exist. Please help me solve this. This is the tutorial i am using http://www.webmonkey.com/2010/02/Use_URL_Patterns_and_Views_in_Django

 from django.conf.urls.defaults import *

 from djangoblog.blog.models import Entry

 from tagging.views import tagged_object_list



  info_dict = {

'queryset': Entry.objects.filter(status=1),

'date_field': 'pub_date',

   }



   urlpatterns = patterns('django.views.generic.date_based',

(r'(?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/(?P<slug>[-w]+)/$', 'object_detail', dict(info_dict, slug_field='slug',template_name='blog/detail.html')),

(r'^(?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/(?P<slug>[-w]+)/$', 'object_detail', dict(info_dict, template_name='blog/list.html')),

(r'^(?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/$','archive_day',dict(info_dict,template_name='blog/list.html')),

(r'^(?P<year>d{4})/(?P<month>[a-z]{3})/$','archive_month', dict(info_dict, template_name='blog/list.html')),

(r'^(?P<year>d{4})/$','archive_year', dict(info_dict, template_name='blog/list.html')),

(r'^$','archive_index', dict(info_dict, template_name='blog/list.html')),

)

1 Answer 1

1

The new view for django.views.generic.date_based.archive_index is django.views.generic.dates.ArchiveIndexView. Refer to https://docs.djangoproject.com/en/1.4/topics/generic-views-migration/ for other migrations associated with Class Based Views

Sign up to request clarification or add additional context in comments.

2 Comments

That tutorial is out of date - django removed the function generic views in 1.4. Class based views are kind of complex and poorly documented, unfortunately. I personally always end up reading the source code rather than bothering with the sparse documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.