Ejemplo n.º 1
0
def content_render(current_path, content):
    path = current_path.selected
    if not content.is_available() or content.path != path:
        raise Http404()
    incr_and_update_instance(content, views=1)
    return path.content_template, 'content', dict(current_path=current_path,
                                                  P=path,
                                                  content=content,
                                                  C=content)
Ejemplo n.º 2
0
def content_show(request, response, column_select, content_id):
    column = column_select.selected
    breadcrumb = column_select.breadcrumb
    Model = column.get_model_object('model')
    if Model is None:
        raise Http404()
    content = get_object_or_404(Model, pk=content_id)
    if not content.is_available() or content.column != column:
        raise Http404()
    incr_and_update_instance(content, views=1)
    return column.content_template, 'content', locals()
Ejemplo n.º 3
0
def index(request, response, current_path):
    path = current_path.selected
    incr_and_update_instance(path, views=1)
    if path.default_view == Path.VIEW_CONTENT:
        model = path.model_class
        if model is None:
            raise Http404()
        try:
            content = model.objects.available().filter(path=path).latest()
        except model.DoesNotExist:
            raise Http404()
        return content_render(current_path, content)
    elif path.default_view == Path.VIEW_LIST:
        return list_render(request, current_path)
    return path.index_template, 'index', dict(current_path=current_path,
                                              P=path)
Ejemplo n.º 4
0
def content_list(request, response, current_path, page):
    incr_and_update_instance(current_path.selected, views=1)
    return list_render(request, current_path, page)
Ejemplo n.º 5
0
def content_list(request, response, column_select):
    column = column_select.selected
    breadcrumb = column_select.breadcrumb
    incr_and_update_instance(column, views=1)
    return column.list_template, 'list', locals()
Ejemplo n.º 6
0
def column(request, response, column_select):
    column = column_select.selected
    breadcrumb = column_select.breadcrumb
    incr_and_update_instance(column, views=1)
    return column.index_template, 'index', locals()