本文整理汇总了Python中tendenci.core.base.template_tags.parse_tag_kwargs函数的典型用法代码示例。如果您正苦于以下问题:Python parse_tag_kwargs函数的具体用法?Python parse_tag_kwargs怎么用?Python parse_tag_kwargs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_tag_kwargs函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: list_studygroups
def list_studygroups(parser, token):
"""
Example:
{% list_studygroups as studygroups_list [user=user limit=3 tags=bloop bleep q=searchterm] %}
{% for studygroup in studygroups %}
{{ studygroup.something }}
{% endfor %}
"""
args, kwargs = [], {}
bits = token.split_contents()
context_var = bits[2]
if len(bits) < 3:
message = "'%s' tag requires more than 2" % bits[0]
raise TemplateSyntaxError(message)
if bits[1] != "as":
message = "'%s' second argument must be 'as'" % bits[0]
raise TemplateSyntaxError(message)
kwargs = parse_tag_kwargs(bits)
if 'order' not in kwargs:
kwargs['order'] = '-create_dt'
return ListStudyGroupsNode(context_var, *args, **kwargs)
开发者ID:fbates,项目名称:tendenci-site,代码行数:27,代码来源:studygroup_tags.py
示例2: list_events
def list_events(parser, token):
"""
Used to pull a list of :model:`events.Event` items.
Usage::
{% list_events as [varname] [options] %}
Be sure the [varname] has a specific name like ``events_sidebar`` or
``events_list``. Options can be used as [option]=[value]. Wrap text values
in quotes like ``tags="cool"``. Options include:
``limit``
The number of items that are shown. **Default: 3**
``order``
The order of the items. Custom options include ``next_upcoming`` for the
events starting after now, and ``current_and_upcoming`` for events going on
as well as upcoming. **Default: Next Upcoming by date**
``user``
Specify a user to only show public items to all. **Default: Viewing user**
``type``
The type of the event.
``tags``
The tags required on items to be included.
``group``
The group id associated with items to be included.
``random``
Use this with a value of true to randomize the items included.
``start_dt``
Specify the date that events should start after to be shown. MUST be in the format 1/20/2013-06:45
Example::
{% list_events as events_list limit=5 tags="cool" %}
{% for event in events_list %}
{{ event.title }}
{% endfor %}
"""
args, kwargs = [], {}
bits = token.split_contents()
context_var = bits[2]
if len(bits) < 3:
message = "'%s' tag requires more than 3" % bits[0]
raise TemplateSyntaxError(_(message))
if bits[1] != "as":
message = "'%s' second argument must be 'as" % bits[0]
raise TemplateSyntaxError(_(message))
kwargs = parse_tag_kwargs(bits)
if 'order' not in kwargs:
kwargs['order'] = 'next_upcoming'
return ListEventsNode(context_var, *args, **kwargs)
开发者ID:BillTheBest,项目名称:tendenci,代码行数:56,代码来源:event_tags.py
示例3: list_files
def list_files(parser, token):
"""
Used to pull a list of :model:`files.File` items.
Usage::
{% list_files as [varname] [options] %}
Be sure the [varname] has a specific name like ``files_sidebar`` or
``files_list``. Options can be used as [option]=[value]. Wrap text values
in quotes like ``tags="cool"``. Options include:
``limit``
The number of items that are shown. **Default: 3**
``order``
The order of the items. **Default: Newest Added**
``user``
Specify a user to only show public items to all. **Default: Viewing user**
``query``
The text to search for items. Will not affect order.
``tags``
The tags required on items to be included.
``group``
The group id associated with items to be included.
``random``
Use this with a value of true to randomize the items included.
Example::
{% list_files as files_list limit=5 tags="cool" %}
{% for file in files_list %}
{{ file.name }}
{% endfor %}
"""
args, kwargs = [], {}
bits = token.split_contents()
context_var = bits[2]
if len(bits) < 3:
message = "'%s' tag requires more than 3" % bits[0]
raise TemplateSyntaxError(message)
if bits[1] != "as":
message = "'%s' second argument must be 'as" % bits[0]
raise TemplateSyntaxError(message)
kwargs = parse_tag_kwargs(bits)
if 'order' not in kwargs:
kwargs['order'] = '-create_dt'
return ListFilesNode(context_var, *args, **kwargs)
开发者ID:MariusCC,项目名称:tendenci,代码行数:52,代码来源:file_tags.py
示例4: list_boxes
def list_boxes(parser, token):
"""
Used to pull a list of :model:`boxes.Box` items.
Usage::
{% list_boxes as [varname] [options] %}
Be sure the [varname] has a specific name like ``boxes_sidebar`` or
``boxes_list``. Options can be used as [option]=[value]. Wrap text values
in quotes like ``tags="cool"``. Options include:
``limit``
The number of items that are shown. **Default: 3**
``order``
The order of the items. **Default: Newest First**
``user``
Specify a user to only show public items to all. **Default: Viewing user**
``query``
The text to search for items. Will not affect order.
``tags``
The tags required on items to be included.
``random``
Use this with a value of true to randomize the items included.
Example::
{% list_boxes as boxes_list limit=5 tags="cool" %}
{% for box in boxes_list %}
<div class="boxes">{{ box.safe_content }}
{% include 'boxes/edit-link.html' %}</div>
{% endfor %}
"""
args, kwargs = [], {}
bits = token.split_contents()
if len(bits) < 3:
message = "'%s' tag requires more than 2" % bits[0]
raise TemplateSyntaxError(_(message))
if bits[1] != "as":
message = "'%s' second argument must be 'as'" % bits[0]
raise TemplateSyntaxError(_(message))
context_var = bits[2]
kwargs = parse_tag_kwargs(bits)
if 'order' not in kwargs:
kwargs['order'] = '-create_dt'
return ListBoxesNode(context_var, *args, **kwargs)
开发者ID:kaisatec,项目名称:tendenci,代码行数:52,代码来源:box_tags.py
示例5: list_navs
def list_navs(parser, token):
"""
Used to pull a list of :model:`navs.Nav` items.
Usage::
{% list_case_studies as [varname] [options] %}
Be sure the [varname] has a specific name like ``case_studies_sidebar`` or
``case_studies_list``. Options can be used as [option]=[value]. Wrap text values
in quotes like ``tags="cool"``. Options include:
``limit``
The number of items that are shown. **Default: 3**
``order``
The order of the items. **Default: ID**
``user``
Specify a user to only show public items to all. **Default: Viewing user**
``query``
The text to search for items. Will not affect order.
``tags``
The tags required on items to be included.
``random``
Use this with a value of true to randomize the items included.
Example::
{% list_navs as nav_list limit=5 tags="cool" %}
{% for nav in nav_list %}
{% nav nav %}
{% endfor %}
"""
args, kwargs = [], {}
bits = token.split_contents()
context_var = bits[2]
if len(bits) < 3:
message = "'%s' tag requires at least 2 parameters" % bits[0]
raise TemplateSyntaxError(message)
if bits[1] != "as":
message = "'%s' second argument must be 'as'" % bits[0]
raise TemplateSyntaxError(message)
kwargs = parse_tag_kwargs(bits)
if 'order' not in kwargs:
kwargs['order'] = 'pk'
return ListNavNode(context_var, *args, **kwargs)
开发者ID:warhotdog,项目名称:tendenci,代码行数:50,代码来源:nav_tags.py
示例6: list_corporate_memberships
def list_corporate_memberships(parser, token):
"""
Used to pull a list of :model:`corporate_memberships.CorpMembership` items.
Usage::
{% list_corporate_memberships as [varname] [options] %}
Be sure the [varname] has a specific name like ``corpmembership_sidebar`` or
``corpmembership_list``. Options can be used as [option]=[value]. Wrap text values
in quotes like ``query="cool"``. Options include:
``limit``
The number of items that are shown. **Default: 3**
``order``
The order of the items. **Default: Newest Approved**
``user``
Specify a user to only show public items to all. **Default: Viewing user**
``query``
The text to search for items. Will not affect order.
``random``
Use this with a value of true to randomize the items included.
Example::
{% list_corporate_memberships as corpmembership_list limit=5 %}
{% for corpmembership in corpmembership_list %}
{{ corpmembership.corp_profile.name }}
{% endfor %}
"""
args, kwargs = [], {}
bits = token.split_contents()
context_var = bits[2]
if len(bits) < 3:
message = "'%s' tag requires at least 2 parameters" % bits[0]
raise TemplateSyntaxError(_(message))
if bits[1] != "as":
message = "'%s' second argument must be 'as'" % bits[0]
raise TemplateSyntaxError(_(message))
kwargs = parse_tag_kwargs(bits)
if 'order' not in kwargs:
kwargs['order'] = '-join_dt'
return ListCorpMembershipNode(context_var, *args, **kwargs)
开发者ID:BillTheBest,项目名称:tendenci,代码行数:48,代码来源:corporate_memberships_tags.py
注:本文中的tendenci.core.base.template_tags.parse_tag_kwargs函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论