當前位置: 首頁>>代碼示例>>Python>>正文


Python Settings.get_current方法代碼示例

本文整理匯總了Python中basic.blog.models.Settings.get_current方法的典型用法代碼示例。如果您正苦於以下問題:Python Settings.get_current方法的具體用法?Python Settings.get_current怎麽用?Python Settings.get_current使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在basic.blog.models.Settings的用法示例。


在下文中一共展示了Settings.get_current方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: post_result_item

# 需要導入模塊: from basic.blog.models import Settings [as 別名]
# 或者: from basic.blog.models.Settings import get_current [as 別名]
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,代碼行數:9,代碼來源:views.py

示例2: post_list

# 需要導入模塊: from basic.blog.models import Settings [as 別名]
# 或者: from basic.blog.models.Settings import get_current [as 別名]
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,代碼行數:9,代碼來源:views.py

示例3: post_result_item

# 需要導入模塊: from basic.blog.models import Settings [as 別名]
# 或者: from basic.blog.models.Settings import get_current [as 別名]
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,代碼行數:9,代碼來源:views.py

示例4: result_item

# 需要導入模塊: from basic.blog.models import Settings [as 別名]
# 或者: from basic.blog.models.Settings import get_current [as 別名]
    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,代碼行數:11,代碼來源:views.py

示例5: server_error

# 需要導入模塊: from basic.blog.models import Settings [as 別名]
# 或者: from basic.blog.models.Settings import get_current [as 別名]
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,代碼行數:12,代碼來源:views.py

示例6: result_item

# 需要導入模塊: from basic.blog.models import Settings [as 別名]
# 或者: from basic.blog.models.Settings import get_current [as 別名]
    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,代碼行數:14,代碼來源:views.py

示例7: home_list

# 需要導入模塊: from basic.blog.models import Settings [as 別名]
# 或者: from basic.blog.models.Settings import get_current [as 別名]
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,代碼行數:19,代碼來源:views.py

示例8: blog_settings

# 需要導入模塊: from basic.blog.models import Settings [as 別名]
# 或者: from basic.blog.models.Settings import get_current [as 別名]
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,代碼行數:19,代碼來源:context_processors.py

示例9: home_list

# 需要導入模塊: from basic.blog.models import Settings [as 別名]
# 或者: from basic.blog.models.Settings import get_current [as 別名]
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,代碼行數:45,代碼來源:views.py

示例10: home_list

# 需要導入模塊: from basic.blog.models import Settings [as 別名]
# 或者: from basic.blog.models.Settings import get_current [as 別名]
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,代碼行數:24,代碼來源:views.py

示例11: settings

# 需要導入模塊: from basic.blog.models import Settings [as 別名]
# 或者: from basic.blog.models.Settings import get_current [as 別名]
 def settings(self):
     if self._settings is None:
         self._settings = Settings.get_current()
     return self._settings
開發者ID:danfairs,項目名稱:django-mingus,代碼行數:6,代碼來源:feeds.py


注:本文中的basic.blog.models.Settings.get_current方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。