# Path: cms_content/settings.py
# ROOT_URL = getattr(settings, 'CMS_CONTENT_ROOT_URL', '/cms/')
# 
# Path: cms_content/settings.py
# ARTICLE_PERPAGE = getattr(settings, 'CMS_CONTENT_ARTICLE_PERPAGE', 10)


from datetime import datetime
from django.http import HttpResponseRedirect
from django.db.models import F
from django.shortcuts import render_to_response
from django.shortcuts import get_object_or_404
from django.shortcuts import get_list_or_404
from django.template.context import RequestContext
from django.core.paginator import Paginator
from django.core.paginator import InvalidPage
from django.core.paginator import EmptyPage
from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import cache_page
from django.utils.translation import ugettext_lazy as _
from cms_content.models import *
from cms_content.utils.render import render_to
from cms_content.forms import CMSArticleFrontendForm
from cms_content.settings import ROOT_URL
from cms_content.settings import ARTICLE_PERPAGE
            from django.core.exceptions import ValidationError
    return {
        'articles': articles,
    }

@cache_page(24*60*60)
@render_to('cms_content/section_list.html')
def section_list(request):
    sections = list(CMSSection.objects.all())
    return {
        'sections': sections,
    }

@cache_page(24*60*60)
@render_to('cms_content/section_detail.html')
def section_detail(request, slug):
    section = CMSSection.objects.get(slug=slug)
    categories = CMSCategory.objects.select_related(depth=1).filter(section=section)
    return {
        'section': section,
        'categories': categories,
    }

#@cache_page(60*30)
@render_to('cms_content/article_list.html')
def category_detail(request, slug):
    """View of list articles of category with name slug
    
    """
    category = CMSCategory.objects.select_related(depth=1).get(slug=slug)
    articles = CMSArticle.pub_manager.select_related(depth=1).filter(category=category)

# Path: cms_content/settings.py
# ROOT_URL = getattr(settings, 'CMS_CONTENT_ROOT_URL', '/cms/')
# 
# Path: cms_content/settings.py
# ARTICLE_PERPAGE = getattr(settings, 'CMS_CONTENT_ARTICLE_PERPAGE', 10)


# Path: cms_content_patch/views.py
from datetime import datetime
from django.http import HttpResponseRedirect
from django.db.models import F
from django.shortcuts import render_to_response
from django.shortcuts import get_object_or_404
from django.shortcuts import get_list_or_404
from django.template.context import RequestContext
from django.core.paginator import Paginator
from django.core.paginator import InvalidPage
from django.core.paginator import EmptyPage
from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import cache_page
from django.utils.translation import ugettext_lazy as _
from cms_content.models import *
from cms_content.utils.render import render_to
from cms_content.forms import CMSArticleFrontendForm
from cms_content.settings import ROOT_URL
from cms_content.settings import ARTICLE_PERPAGE
            from django.core.exceptions import ValidationError

    return {
        'articles': articles,
    }

@cache_page(24*60*60)
@render_to('cms_content/section_list.html')
def section_list(request):
    sections = list(CMSSection.objects.all())
    return {
        'sections': sections,
    }

@cache_page(24*60*60)
@render_to('cms_content/section_detail.html')
def section_detail(request, slug):
    section = CMSSection.objects.get(slug=slug)
    categories = CMSCategory.objects.select_related(depth=1).filter(section=section)
    return {
        'section': section,
        'categories': categories,
    }

#@cache_page(60*30)
@render_to('cms_content/article_list.html')
def category_detail(request, slug):
    """View of list articles of category with name slug
    
    """
    category = CMSCategory.objects.select_related(depth=1).get(slug=slug)
    articles = CMSArticle.pub_manager.select_related(depth=1).filter(category=category)

    paginator = Paginator(articles, ARTICLE_PERPAGE)