当前位置: 首页>>代码示例>>Python>>正文


Python models.Settings类代码示例

本文整理汇总了Python中basic.blog.models.Settings的典型用法代码示例。如果您正苦于以下问题:Python Settings类的具体用法?Python Settings怎么用?Python Settings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Settings类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post_result_item

def post_result_item(post):
    '''Generates the item result object for django-springsteen integration.'''
    return {
        'title': post.title,
        'url': build_url(Settings.get_current().site.domain) + post.get_absolute_url(),
        'text': post.body,
        }
开发者ID:9gix,项目名称:me,代码行数:7,代码来源:views.py

示例2: post_list

def post_list(request, page=0, paginate_by=20, **kwargs):

    page_size = Settings.get_current().page_size

    return list_detail.object_list(
        request, queryset=Post.objects.published(), paginate_by=page_size, page=page, **kwargs
    )
开发者ID:tdavis,项目名称:django-basic-apps,代码行数:7,代码来源:views.py

示例3: post_result_item

def post_result_item(post):
    """Generates the item result object for django-springsteen integration."""
    return {
        "title": post.title,
        "url": build_url(Settings.get_current().site.domain) + post.get_absolute_url(),
        "text": post.body,
    }
开发者ID:rlr,项目名称:sitesprint09,代码行数:7,代码来源:views.py

示例4: result_item

    def result_item(proxy):
        """Generates the item result object."""

        if proxy.content_type.name == "bookmark":
            url = proxy.content_object.get_absolute_url()
        else:
            url = build_url(Settings.get_current().site.domain) + proxy.content_object.get_absolute_url()

        return {"title": proxy.title, "url": url, "text": proxy.description}
开发者ID:rlr,项目名称:sitesprint09,代码行数:9,代码来源:views.py

示例5: server_error

def server_error(request, template_name='500.html'):
    """Handles displaying 500 server error page along with application MEDIA."""
    t = loader.get_template(template_name)
    blog_settings = Settings.get_current()

    return http.HttpResponseServerError(t.render(Context({
        "MEDIA_URL": settings.MEDIA_URL,
        "STATIC_URL": settings.STATIC_URL,
        "BLOG_SETTINGS": blog_settings,
    })))
开发者ID:pmarti,项目名称:django-mingus,代码行数:10,代码来源:views.py

示例6: result_item

    def result_item(proxy):
        """Generates the item result object."""
        if proxy.content_type.name == 'bookmark':
            url = proxy.content_object.get_absolute_url()
        else:
            url = build_url(Settings.get_current().site.domain) + proxy.content_object.get_absolute_url()

        return {
            'title': proxy.title,
            'url': url,
            'text': proxy.description,
        }
开发者ID:pmarti,项目名称:django-mingus,代码行数:12,代码来源:views.py

示例7: home_list

def home_list(request, page=0, template_name="proxy/proxy_list.html", **kwargs):
    """
    Homepage.

    Template: ``proxy/proxy_list.html``
    Context:
        object_list
            Aggregated list of Proxy instances (post, quote, bookmark).

    """

    posts = Proxy.objects.published().order_by("-pub_date")
    pagesize = Settings.get_current().page_size or 20

    return list_detail.object_list(
        request, queryset=posts, paginate_by=pagesize, page=page, template_name=template_name, **kwargs
    )
开发者ID:rlr,项目名称:sitesprint09,代码行数:17,代码来源:views.py

示例8: blog_settings

def blog_settings(request):
    """
    Adds settings information to the context.

    To employ, add the basic_settings method reference to your project
    settings TEMPLATE_CONTEXT_PROCESSORS.

    Example:
        TEMPLATE_CONTEXT_PROCESSORS = (
            ...
            "basic.blog.context_processors.blog_settings",
        )
    """

    blog_settings = Settings.get_current()

    return {"BLOG_SETTINGS": blog_settings}
开发者ID:rlr,项目名称:django-basic-apps,代码行数:17,代码来源:context_processors.py

示例9: home_list

def home_list(request, page=0, template_name='proxy/proxy_list.html', **kwargs):
    '''
    Homepage.

    Template: ``proxy/proxy_list.html``
    Context:
        object_list
            Aggregated list of Proxy instances (post, quote, bookmark).

    '''

    posts = Proxy.objects.published().select_related('content_type').order_by('-pub_date')
    pagesize = getattr(Settings.get_current(), 'page_size', 20)

    paginator = Paginator(posts, pagesize)

    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1

    try:
        current_page = paginator.page(page)
    except (EmptyPage, InvalidPage):
        current_page = paginator.page(paginator.num_pages)

    items = list(current_page.object_list)
    counter = 0
    model_map = {}
    for item in items:
        model_map.setdefault(item.content_type, []).append(item.object_id)

    for ct, items_ in model_map.items():
        for o in ct.model_class().objects.select_related() \
                .filter(id__in=items_).all():
            items[counter].content_object = o
            counter += 1

    return render_to_response(template_name, {
        'object_list': items,
        'page': page,
        'paginate_by': pagesize,
    }, context_instance=RequestContext(request))
开发者ID:apluggedinlife,项目名称:apluggedinlife,代码行数:43,代码来源:views.py

示例10: home_list

def home_list(request, page=0, template_name='proxy/proxy_list.html', **kwargs):
    '''
    Homepage.

    Template: ``proxy/proxy_list.html``
    Context:
        object_list
            Aggregated list of Proxy instances (post, quote, bookmark).

    '''

    posts = Proxy.objects.published().order_by('-pub_date')
    pagesize = getattr(Settings.get_current(), 'page_size', 20)

    return list_detail.object_list(
        request,
        queryset = posts,
        paginate_by = pagesize,
        page = page,
        template_name = template_name,
        **kwargs
    )
开发者ID:9gix,项目名称:me,代码行数:22,代码来源:views.py

示例11: settings

 def settings(self):
     if self._settings is None:
         self._settings = Settings.get_current()
     return self._settings
开发者ID:danfairs,项目名称:django-mingus,代码行数:4,代码来源:feeds.py


注:本文中的basic.blog.models.Settings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。