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


Python Category.list_slugs方法代码示例

本文整理汇总了Python中models.Category.list_slugs方法的典型用法代码示例。如果您正苦于以下问题:Python Category.list_slugs方法的具体用法?Python Category.list_slugs怎么用?Python Category.list_slugs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Category的用法示例。


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

示例1: patterns

# 需要导入模块: from models import Category [as 别名]
# 或者: from models.Category import list_slugs [as 别名]
from django.conf.urls.defaults import * #@UnusedWildImport
from models import Category
from views.catalog import CATALOG_FILTERS

category_pattern = '(?P<slug>' + '|'.join(Category.list_slugs()) + ')';
filter_pattern = '(?P<filter>' + '|'.join([x[0] for x in CATALOG_FILTERS]) + ')'
item_pattern = "(?P<item_slug>.*?)/Products/Detail/(?P<id>[1-9][0-9]*)"

item_actions = ['hint-details', 'details', 'muze-description', 'get-more-reviews', 'media-details', 'get-all-reviews', 'get-helpful-reviews']

urlpatterns = patterns('project.catalog.views',
    url('^Browse-Games/$', 'index_new', name='index', kwargs={'slug': None}),
    url('^%s/$' % category_pattern, 'index_new', name='category'),
    url('^%s/Sub/$' % category_pattern, 'index_new', name='category_sub'),

#    url('^Browse-Games/%s/$' % filter_pattern, 'category', name='index', kwargs={'slug': None}),
#    url('^Browse-Games/$', 'category', name='index', kwargs={'slug': None, 'filter': None}),
#
#    url('^%s/%s/$' % (category_pattern, filter_pattern), 'category', name='category'),
#    url('^%s/$' % category_pattern, 'category', name='category', kwargs={'filter': None}),

    url('^%s/$' % item_pattern, 'item', name='item'),
    url('^%s/(?P<action>%s)/$' % (item_pattern, '|'.join(item_actions)), 'item_action', name='item_action'),

    url('Browse-Games/_/popular-by-publisher/(?P<id>[1-9][0-9]*)/$', 'popular_by_publisher', name='popular-by-publisher'),
    url('Browse-Games/_/popular-by-category/%s/$' % category_pattern, 'popular_by_category', name='popular-by-category'),

    url('Rate/(?P<id>[1-9][0-9]*)/(?P<rating>[1-5]*)/$', 'rate', name='rate'),
    url('Rate/(?P<id>[1-9][0-9]*)/Delete/$', 'delete_rate', name='delete_rate'),
    url('Review/Vote/(?P<id>[1-9][0-9]*)/(?P<vote>yes|no)/$', 'mark_useful', name='mark_useful'),
    url('Review/(?P<id>[1-9][0-9]*)/Delete/$', 'delete_review', name='delete_review'),
开发者ID:chrisblythe812,项目名称:gamemine,代码行数:33,代码来源:urls.py


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