本文整理汇总了Python中mkt.webapps.models.Webapp.popular方法的典型用法代码示例。如果您正苦于以下问题:Python Webapp.popular方法的具体用法?Python Webapp.popular怎么用?Python Webapp.popular使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mkt.webapps.models.Webapp
的用法示例。
在下文中一共展示了Webapp.popular方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _landing
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import popular [as 别名]
def _landing(request, category=None):
if category:
category = get_object_or_404(Category.objects.filter(type=amo.ADDON_WEBAPP, weight__gte=0), slug=category)
featured = Webapp.featured(category)
popular = Webapp.popular().filter(category=category.id)
else:
popular = Webapp.popular()
featured = Webapp.featured(None)
return jingo.render(
request, "browse/landing.html", {"category": category, "featured": featured[:6], "popular": popular[:6]}
)
示例2: _landing
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import popular [as 别名]
def _landing(request, category=None):
region = getattr(request, 'REGION', mkt.regions.WORLDWIDE)
if category:
category = get_object_or_404(
Category.objects.filter(type=amo.ADDON_WEBAPP, weight__gte=0),
slug=category)
featured = Webapp.featured(cat=category, region=region)
popular = _add_mobile_filter(request,
Webapp.popular(cat=category, region=region))
else:
popular = _add_mobile_filter(request, Webapp.popular(region=region))
featured = Webapp.featured(region=region)
return jingo.render(request, 'browse/landing.html', {
'category': category,
'featured': featured[:6],
'popular': popular[:6]
})
示例3: home
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import popular [as 别名]
def home(request):
"""The home page."""
if not getattr(request, 'can_view_consumer', True):
return jingo.render(request, 'home/home_walled.html')
featured = Webapp.featured('home')[:3]
popular = Webapp.popular()[:6]
return jingo.render(request, 'home/home.html', {
'featured': featured,
'popular': popular
})
示例4: home
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import popular [as 别名]
def home(request):
"""The home page."""
if not getattr(request, 'can_view_consumer', True):
return jingo.render(request, 'home/home_walled.html')
region = getattr(request, 'REGION', mkt.regions.WORLDWIDE)
featured = Webapp.featured(region=region, cat=None)[:9]
popular = _add_mobile_filter(request, Webapp.popular(region=region))[:10]
latest = _add_mobile_filter(request, Webapp.latest(region=region))[:10]
return jingo.render(request, 'home/home.html', {
'featured': featured,
})
示例5: home
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import popular [as 别名]
def home(request):
"""The home page."""
if not getattr(request, 'can_view_consumer', True):
return jingo.render(request, 'home/home_walled.html')
featured = Webapp.featured(cat=None)
popular = Webapp.popular()[:10]
latest = Webapp.latest()[:10]
return jingo.render(request, 'home/home.html', {
'featured': featured,
'popular': popular,
'latest': latest
})
示例6: _landing
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import popular [as 别名]
def _landing(request, category=None):
featured = Webapp.featured('category')
popular = Webapp.popular()
if category:
category = get_object_or_404(
Category.objects.filter(type=amo.ADDON_WEBAPP, weight__gte=0),
slug=category)
featured = featured.filter(category=category)[:6]
popular = popular.filter(category=category.id)
return jingo.render(request, 'browse/landing.html', {
'category': category,
'featured': featured[:6],
'popular': popular[:6]
})
示例7: test_disable_paid_popular_apps
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import popular [as 别名]
def test_disable_paid_popular_apps(self):
eq_(list(Webapp.popular(region=mkt.regions.WORLDWIDE)), [])