本文整理汇总了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'),