django function based generic views migration to class based views -


i migrated django 1.4 django 1.5 , getting error

viewdoesnotexist: not import django.views.generic.date_based.archive_index. parent module django.views.generic.date_based not exist. 

googling gives me function based views have been deprecieted. trying migrate class based views finding difficult. here views.py

from app.models import season django.conf.urls import * cms.models import news, file   def get_extra_context():     past_seasons = season.objects.filter(in_progress = false)     try:         current_season = season.objects.get(in_progress = true)     except season.doesnotexist:         current_season = none     files = file.objects.all().order_by('-id')[:5]     output = {         'current_season': current_season,         'past_seasons': past_seasons,         'files': files,         }     return output  dictionary = {     'queryset': news.objects.all(),     'date_field': 'date',     'extra_context': get_extra_context(), }   urlpatterns= patterns(     'django.views.generic.date_based',     url(         r'(?p<year>\d{4})/(?p<month>\w{3})/(?p<day>\d{2})/(?p<slug>[-\w]+)/$',         'object_detail',         dict(dictionary, slug_field = 'slug', template_name = 'cms/news/object.html'),         name='object'     ),     url(         r'^$',         'archive_index',         dict(dictionary, template_name = 'cms/news/list.html'),         name='list'     ) ) 

i not able convert class based views. can body help. dictionary object want put context.

thanks in advance.

//mouse

here how did it.

urlpatterns = patterns(     '',     url(         r'(?p<year>\d{4})/(?p<month>\w{3})/(?p<day>\d{2})/(?p<slug>[-\w]+)/$',         datedetailview.as_view(             model = news,             date_field = 'date',             slug_field = 'slug',             template_name = 'cms/news/object.html',             #dict = dictionary,         ),         name='object'     ), ) 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -