def blog_archive_year(request, **kwargs): kwargs['queryset'] = kwargs['queryset'].published() set_language_changer(request, language_changer) return archive_year(request, **kwargs) def blog_archive_month(request, **kwargs): kwargs['queryset'] = kwargs['queryset'].published() set_language_changer(request, language_changer) return archive_month(request, **kwargs) def blog_archive_day(request, **kwargs): kwargs['queryset'] = kwargs['queryset'].published() set_language_changer(request, language_changer) return archive_day(request, **kwargs) blog_detail = EntryDateDetailView.as_view() def blog_archive_tagged(request, **kwargs): kwargs['queryset_or_model'] = kwargs['queryset_or_model'].published() set_language_changer(request, language_changer) return tagged_object_list(request, **kwargs) def blog_archive_author(request, **kwargs): author = kwargs.pop('author') kwargs['queryset'] = kwargs['queryset'].published().filter(entrytitle__author__username=author) kwargs['extra_context'] = { 'author': get_object_or_404(User, username=author), } set_language_changer(request, language_changer) return object_list(request, **kwargs)
return archive_year(request, **kwargs) def blog_archive_month(request, **kwargs): kwargs['queryset'] = kwargs['queryset'].published() set_language_changer(request, language_changer) return archive_month(request, **kwargs) def blog_archive_day(request, **kwargs): kwargs['queryset'] = kwargs['queryset'].published() set_language_changer(request, language_changer) return archive_day(request, **kwargs) blog_detail = EntryDateDetailView.as_view() def blog_archive_tagged(request, **kwargs): kwargs['queryset_or_model'] = kwargs['queryset_or_model'].published() set_language_changer(request, language_changer) return tagged_object_list(request, **kwargs) def blog_archive_author(request, **kwargs): author = kwargs.pop('author') kwargs['queryset'] = kwargs['queryset'].published().filter( entrytitle__author__username=author) kwargs['extra_context'] = { 'author': author, }
from cmsplugin_blog.views import EntryDateDetailView, EntryArchiveIndexView, BlogYearArchiveView, BlogMonthArchiveView, BlogDayArchiveView, BlogAuthorArchiveView, BlogTaggedArchiveView blog_info_dict = { 'queryset': Entry.objects.all(), 'date_field': 'pub_date', 'allow_empty': True, 'paginate_by': 15, } #def language_changer(lang): # request = language_changer.request # return request.get_full_path() blog_detail = EntryDateDetailView.as_view( queryset=Entry.objects.all(), date_field='pub_date', month_format='%m', slug_field='entrytitle__slug', ) urlpatterns = patterns( '', url(r'^$', EntryArchiveIndexView.as_view(), blog_info_dict, name='blog_archive_index'), url(r'^(?P<year>\d{4})/$', BlogYearArchiveView.as_view(), name='blog_archive_year'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$', BlogMonthArchiveView.as_view(), name='blog_archive_month'),
'queryset': Entry.objects.all(), 'date_field': 'pub_date', 'allow_empty': True, 'paginate_by': 15, } def language_changer(lang): request = language_changer.request return request.get_full_path() blog_detail = EntryDateDetailView.as_view( queryset=Entry.objects.all(), date_field='pub_date', month_format='%m', slug_field='entrytitle__slug', ) urlpatterns = patterns('', url(r'^$', EntryArchiveIndexView.as_view(), blog_info_dict, name='blog_archive_index'), url(r'^(?P<year>\d{4})/$', BlogYearArchiveView.as_view(), name='blog_archive_year'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$', BlogMonthArchiveView.as_view(), name='blog_archive_month'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', BlogDayArchiveView.as_view(), name='blog_archive_day'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',