當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。